Greetings everyone,
I was wondering whether it is possible to design a trait that only grants its bonus when the unit is standing next to an ally. If possible, preferably even an ally with a certain trait or weapon.
What I want the trait to do: <Description>+10% Attack and Defense when adjacent to a friendly unit (with this trait)</Description>
The trait is working so far, but I can't find a way to disable the bonuses when the unit is not next to a friendly unit.
Current code: (contains no attempt at limiting the bonus to a specific situation)
<AbilityBonus InternalName="PhalanxAbility">
<AbilityBonusType>Unit_Design</AbilityBonusType>
<AbilityBonusOption InternalName="Phalanx">
<DisplayName>Phalanx</DisplayName>
<Description>+10% Attack and Defense when adjacent to a unit with this trait</Description>
<Prereq>
<Type>AbilityBonusOption</Type>
<Attribute>Defensive</Attribute>
<Target>Player</Target>
</Prereq>
<Icon>Ability_PackTactics_Icon.png</Icon>
<GameModifier>
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_Defense_Pierce</StrVal>
<Multiplier>1.1</Multiplier>
<Provides>+10% Defense when standing next to an ally with the Phalanx ability</Provides>
</GameModifier>
<GameModifier>
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_Attack_Pierce</StrVal>
<Multiplier>1.1</Multiplier>
<Provides>+10% Attack when standing next to an ally with the Phalanx ability</Provides>
</GameModifier>
<AdditionalTrainingTurns>-100</AdditionalTrainingTurns>
<Type>Defensive</Type>
<AIData AIPersonality="AI_General">
<AIPriority>5</AIPriority>
</AIData>
</AbilityBonusOption>
</AbilityBonus>
The negative training cost is for testing purposes.