1
0
forked from 0ad/0ad

Added civ support to the attack bonuses and removed unnecessary classes

This was SVN commit r10835.
This commit is contained in:
Jonathan Waller 2011-12-29 22:08:59 +00:00
parent 325c344ddd
commit dca6d41d45
28 changed files with 46 additions and 73 deletions

View File

@ -7,6 +7,9 @@ var bonusesSchema =
"<element>" +
"<anyName/>" +
"<interleave>" +
"<optional>" +
"<element name='Civ' a:help='If an entity has this civ then the bonus is applied'><text/></element>" +
"</optional>" +
"<element name='Classes' a:help='If an entity has all these classes then the bonus is applied'><text/></element>" +
"<element name='Multiplier' a:help='The attackers attack strength is multiplied by this'><ref name='nonNegativeDecimal'/></element>" +
"</interleave>" +
@ -26,6 +29,7 @@ Attack.prototype.Schema =
"<RepeatTime>1000</RepeatTime>" +
"<Bonuses>" +
"<Bonus1>" +
"<Civ>pers</Civ>" +
"<Classes>Infantry</Classes>" +
"<Multiplier>1.5</Multiplier>" +
"</Bonus1>" +
@ -170,11 +174,13 @@ Attack.prototype.GetAttackBonus = function(type, target)
var bonus = this.template[type].Bonuses[key];
var hasClasses = true;
var classes = bonus.Classes.split(/\s+/);
for (var key in classes)
hasClasses = hasClasses && cmpIdentity.HasClass(classes[key]);
if (bonus.Classes){
var classes = bonus.Classes.split(/\s+/);
for (var key in classes)
hasClasses = hasClasses && cmpIdentity.HasClass(classes[key]);
}
if (hasClasses)
if (hasClasses && (!bonus.Civ || bonus.Civ === cmpIdentity.GetCiv()))
attackBonus *= bonus.Multiplier;
}
}

View File

@ -64,40 +64,15 @@ Identity.prototype.Schema =
"<list>" +
"<zeroOrMore>" +
"<choice>" +
"<value>Cart</value>" +
"<value>Celt</value>" +
"<value>Hele</value>" +
"<value>Iber</value>" +
"<value>Pers</value>" +
"<value>Rome</value>" +
"<value>Unit</value>" +
"<value>Infantry</value>" +
"<value>Melee</value>" +
"<value>InfantrySpearman</value>" +
"<value>InfantrySwordsman</value>" +
"<value>Cavalry</value>" +
"<value>CavalrySpearman</value>" +
"<value>CavalrySwordsman</value>" +
"<value>CavalrySkirmisher</value>" +
"<value>CavalryArcher</value>" +
"<value>Ranged</value>" +
"<value>InfantrySlinger</value>" +
"<value>InfantrySkirmisher</value>" +
"<value>InfantryArcher</value>" +
"<value>Mechanical</value>" +
"<value>Ship</value>" +
"<value>Siege</value>" +
"<value>Champion</value>" +
"<value>ChampionInfantry</value>" +
"<value>ChampionSpearman</value>" +
"<value>ChampionSwordsman</value>" +
"<value>ChampionSkirmisher</value>" +
"<value>ChampionArcher</value>" +
"<value>ChampionCavalry</value>" +
"<value>ChampionCavalrySpearman</value>" +
"<value>ChampionCavalrySwordsman</value>" +
"<value>ChampionCavalrySkirmisher</value>" +
"<value>ChampionCavalryArcher</value>" +
"<value>Hero</value>" +
"<value>Elephant</value>" +
"<value>Chariot</value>" +
@ -132,10 +107,6 @@ Identity.prototype.Schema =
"<value>DropsiteWood</value>" +
"<value>DropsiteStone</value>" +
"<value>DropsiteMetal</value>" +
"<value a:help='Primary weapon type'>Bow</value>" + // TODO: what are these used for?
"<value a:help='Primary weapon type'>Javelin</value>" +
"<value a:help='Primary weapon type'>Spear</value>" +
"<value a:help='Primary weapon type'>Sword</value>" +
"</choice>" +
"</zeroOrMore>" +
"</list>" +

View File

@ -33,7 +33,7 @@
</Resources>
</Cost>
<Identity>
<Classes datatype="tokens">InfantrySpearman Spear</Classes>
<Classes datatype="tokens">Spear</Classes>
<GenericName>Spearman</GenericName>
<Rollover>Probably one of the most primitive units in the game. Fighting with a sharp object at the end of the pole didn't require a lot of technology to develop. It also allowed the human to distance themselves from their attacker. As time passed the spears got longer and longer. Started with a fighting style similar to using a quarterstaff, then to using them in numbers as a 'pin cushion' vs. humans (sarissa in a phalanx). Later it was developed to combat cavalry. During the medieval period it evolved to the pike. These units tended to be armoured as heavily as possible.</Rollover>
<Tooltip>Counters Cavalry. Countered by Archers.</Tooltip>

View File

@ -48,7 +48,7 @@
</Resources>
</Cost>
<Identity>
<Classes datatype="tokens">InfantrySwordsman Sword</Classes>
<Classes datatype="tokens">Sword</Classes>
<GenericName>Swordsman</GenericName>
<Rollover>Weapon is basically a developed sickle. Probably from the club, to the axe, to the sickle to the sword. It was the Romans who used them to combat the long range of the sarissa. Their spears were so long they had to use two hands to wield them. In a formation they were almost impossible to maneouvre. If flanked, they were easily cut down by a sword as demonstrated by the Romans at the battle of Cynoscephalae. Generally swordsmen were well armoured, had shields, and tended to be nobles. A good sword was an expensive weapon.</Rollover>
<Tooltip>Counters Spearmen, Skirmishers, and Elephants. Countered by Archers.</Tooltip>

View File

@ -2,7 +2,6 @@
<Entity parent="template_unit_champion_infantry_pikeman">
<Identity>
<Civ>cart</Civ>
<Classes datatype="tokens">Cart</Classes>
<GenericName>Sacred Band Pikeman</GenericName>
<SpecificName>Mašal</SpecificName>
<History>The Sacred Band was a group of elite troops dedicated to the service of the Phoenician god Ba'al. In addition to providing crack troops, the unit trained Carthaginians aspiring to command Punic mercenary armies. Specially picked troops carried the unit standard emblazoned with the symbols of Carthage into battle.</History>

View File

@ -22,7 +22,7 @@
</Health>
<Identity>
<Civ>celt</Civ>
<Classes datatype="tokens">Celt Chariot</Classes>
<Classes datatype="tokens">Chariot</Classes>
<GenericName>Celtic Chariot</GenericName>
<SpecificName>Carbanto</SpecificName>
<Tooltip>Brythonic Champion Chariot.

View File

@ -28,7 +28,7 @@
</Health>
<Identity>
<Civ>celt</Civ>
<Classes datatype="tokens">Celt Chariot</Classes>
<Classes datatype="tokens">Chariot</Classes>
<SpecificName>Boudicca</SpecificName>
<Tooltip>Hero Aura: Increased Attack and Speed for Champion Units.</Tooltip>
<History>Ammianus Marcellinus described how difficult it would be for a band of foreigners to deal with a Celt if he called in the help of his wife. For she was stronger than he was and could rain blows and kicks upon the assailants equal in force to the shots of a catapult. Boudicca, queen of the Iceni, was said to be 'very tall and terrifying in appearance; her voice was very harsh and a great mass of red hair fell over her shoulders. She wore a tunic of many colours over which a thick cloak was fastened by a brooch.</History>

View File

@ -26,7 +26,6 @@
</Health>
<Identity>
<Civ>celt</Civ>
<Classes datatype="tokens">Celt</Classes>
<SpecificName>Reithe</SpecificName>
<Tooltip>Siege Ram</Tooltip>
<History>Celtic assaults on fortified positions were relegated largely to three methods. Creating a shell of shields and setting fire to gatehouses, sapping, at which they were noted as being most expert by Caesar, and rams, known only from votive inscriptions and some Celtic art.</History>

View File

@ -2,7 +2,6 @@
<Entity parent="template_unit_champion_infantry_pikeman">
<Identity>
<Civ>hele</Civ>
<Classes datatype="tokens">Hele</Classes>
<GenericName>Foot Companion</GenericName>
<SpecificName>Pezétairos</SpecificName>
<Tooltip>Macedonian Champion Pikeman.

View File

@ -12,23 +12,28 @@
<MaxRange>6.0</MaxRange>
<Bonuses>
<BonusCarths>
<Classes>Cart</Classes>
<Civ>cart</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusCarths>
<BonusCelts>
<Classes>Celt</Classes>
<Civ>celt</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusCelts>
<BonusIberians>
<Classes>Iber</Classes>
<Civ>iber</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusIberians>
<BonusPersians>
<Classes>Pers</Classes>
<Civ>pers</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusPersians>
<BonusRomans>
<Classes>Rome</Classes>
<Civ>rome</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusRomans>
</Bonuses>
@ -39,23 +44,28 @@
<MaxRange>6.0</MaxRange>
<Bonuses>
<BonusCarths>
<Classes>Cart</Classes>
<Civ>cart</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusCarths>
<BonusCelts>
<Classes>Celt</Classes>
<Civ>celt</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusCelts>
<BonusIberians>
<Classes>Iber</Classes>
<Civ>iber</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusIberians>
<BonusPersians>
<Classes>Pers</Classes>
<Civ>pers</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusPersians>
<BonusRomans>
<Classes>Rome</Classes>
<Civ>rome</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusRomans>
</Bonuses>
@ -69,7 +79,6 @@
</Cost>
<Identity>
<Civ>hele</Civ>
<Classes datatype="tokens">Hele</Classes>
<GenericName>Spartan Hoplite</GenericName>
<SpecificName>Spartiā́tēs</SpecificName>
<Tooltip>Poleis Champion Spearman.

View File

@ -20,7 +20,6 @@
</Cost>
<Identity>
<Civ>iber</Civ>
<Classes datatype="tokens">Iber</Classes>
<SelectionGroupName>units/iber_infantry_swordsman_b</SelectionGroupName>
<SpecificName>Caetrati</SpecificName>
<Icon>units/iber_infantry_swordsman.png</Icon>

View File

@ -34,7 +34,6 @@
</Health>
<Identity>
<Civ>iber</Civ>
<Classes datatype="tokens">Iber</Classes>
<SpecificName>Ariete</SpecificName>
<Tooltip>Siege Ram</Tooltip>
<History>It is not known if any of the Iberians culture tribes used rams; the unit is added to the civ roster for gameplay purposes.</History>

View File

@ -12,7 +12,8 @@
<MaxRange>6.0</MaxRange>
<Bonuses>
<BonusPersians>
<Classes>Pers</Classes>
<Civ>pers</Civ>
<Classes></Classes>
<Multiplier>1.25</Multiplier>
</BonusPersians>
</Bonuses>
@ -24,7 +25,8 @@
<MaxRange>6.0</MaxRange>
<Bonuses>
<BonusPersians>
<Classes>Pers</Classes>
<Civ>pers</Civ>
<Classes></Classes>
<Multiplier>1.25</Multiplier>
</BonusPersians>
</Bonuses>
@ -40,7 +42,6 @@
</Health>
<Identity>
<Civ>hele</Civ>
<Classes datatype="tokens">Hele</Classes>
<GenericName>Macedonian Shield Bearer</GenericName>
<SpecificName>Hypaspist</SpecificName>
<History>The Hypaspistai, or "shield bearers", were the flower of the Macedonian infantry. They were the most battle hardened veterans within the army and followed Philip II and Alexander the Great into over a dozen full scale engagements. These heavily armed and opulently armoured units acted as an intermediary between the phalanx and the cavalry arm, many times charging headlong with Alexander into a breech in the enemy lines. Sometimes they fought as slow pikemen, like the Pezhetairoi with 6 meter "sarissas", and other times they fought as Hoplites with large aspides and 2.5 meter-long spears, or "dorata". In later times they became known as the Argyraspidai, or "Silver Shields" when Alexander bestowed upon them armor and shields plated in pure silver, and played a decisive role in the early Diadochoi Wars of Alexander's "Successors."</History>

View File

@ -28,7 +28,7 @@
</Health>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers Chariot</Classes>
<Classes datatype="tokens">Chariot</Classes>
<SelectionGroupName>units/pers_cavalry_archer_b</SelectionGroupName>
<GenericName>Babylonian Scythed Chariot</GenericName>
<SpecificName>Babiruviya Ratha</SpecificName>

View File

@ -2,7 +2,6 @@
<Entity parent="template_unit_cavalry_ranged_javelinist">
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<SelectionGroupName>units/pers_cavalry_javelinist_b</SelectionGroupName>
<GenericName>Median Light Cavalry</GenericName>
<SpecificName>Mada Asabara</SpecificName>

View File

@ -7,7 +7,6 @@
</Cost>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<SelectionGroupName>units/pers_cavalry_spearman_b</SelectionGroupName>
<GenericName>Cappadocian Lancers</GenericName>
<SpecificName>Katpaduka Asabara</SpecificName>

View File

@ -7,7 +7,6 @@
</Cost>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<SelectionGroupName>units/pers_cavalry_swordsman_b</SelectionGroupName>
<GenericName>Hyrcanian Cavalry</GenericName>
<SpecificName>Varkaniya Asabara</SpecificName>

View File

@ -27,7 +27,6 @@
</Health>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<GenericName>Bactrian Heavy Lancer</GenericName>
<SpecificName>Bakhtrish Asabara</SpecificName>
<Icon>units/pers_champion_cavalry.png</Icon>

View File

@ -9,7 +9,6 @@
</Cost>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<GenericName>Persian Immortal</GenericName>
<SpecificName>Anusiya</SpecificName>
<Icon>units/pers_champion_infantry.png</Icon>

View File

@ -2,7 +2,6 @@
<Entity parent="template_unit_hero_cavalry_spearman">
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<GenericName>Cyrus II The Great</GenericName>
<SpecificName>Kurush II</SpecificName>
<Icon>units/pers_hero_cyrus.png</Icon>

View File

@ -30,7 +30,7 @@
</Health>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers Chariot</Classes>
<Classes datatype="tokens">Chariot</Classes>
<GenericName>Darius The Great</GenericName>
<SpecificName>Darayavahush I</SpecificName>
<Icon>units/pers_hero_darius.png</Icon>

View File

@ -2,7 +2,6 @@
<Entity parent="template_unit_hero_infantry_archer">
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<GenericName>Xerxes I</GenericName>
<SpecificName>Xsayarsa I</SpecificName>
<Icon>units/pers_hero_xerxes.png</Icon>

View File

@ -30,7 +30,7 @@
</Health>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers Chariot</Classes>
<Classes datatype="tokens">Chariot</Classes>
<GenericName>Xerxes I</GenericName>
<SpecificName>Xsayarsa I</SpecificName>
<Icon>units/pers_hero_xerxes.png</Icon>

View File

@ -21,7 +21,6 @@
</Health>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<SelectionGroupName>units/pers_infantry_archer_b</SelectionGroupName>
<GenericName>Sogdian Archer</GenericName>
<SpecificName>Sugda Thanuvaniya</SpecificName>

View File

@ -19,7 +19,6 @@
</Health>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<SelectionGroupName>units/pers_infantry_javelinist_b</SelectionGroupName>
<GenericName>Anatolian Auxiliary</GenericName>
<SpecificName>Spardiya Takabara</SpecificName>

View File

@ -18,7 +18,6 @@
</Health>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<SelectionGroupName>units/pers_infantry_spearman_b</SelectionGroupName>
<GenericName>Median Shieldbearer</GenericName>
<SpecificName>Mada Sparabara</SpecificName>
@ -31,4 +30,4 @@
<VisualActor>
<Actor>units/persians/infantry_spearman_b.xml</Actor>
</VisualActor>
</Entity>
</Entity>

View File

@ -31,7 +31,6 @@
</GarrisonHolder>
<Identity>
<Civ>pers</Civ>
<Classes datatype="tokens">Pers</Classes>
<GenericName>Assyrian Siege Ram</GenericName>
<SpecificName>Athuriya Hamaranakuba</SpecificName>
<Tooltip>Siege Ram. Bonused vs. Wall Gates. Garrison: 5.</Tooltip>

View File

@ -7,7 +7,8 @@
<MaxRange>6.0</MaxRange>
<Bonuses>
<BonusGreeks>
<Classes>Hele</Classes>
<Civ>hele</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusGreeks>
</Bonuses>
@ -18,7 +19,8 @@
<MaxRange>6.0</MaxRange>
<Bonuses>
<BonusGreeks>
<Classes>Hele</Classes>
<Civ>hele</Civ>
<Classes></Classes>
<Multiplier>1.1</Multiplier>
</BonusGreeks>
</Bonuses>