Activating traits by proximity of allies

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.

12,203 views 5 replies
Reply #2 Top

Not possible.

Reply #4 Top


While the defense side of things is not possible, the offense side of things is basically done in the swarm bonus.

Reply #5 Top

Quoting GFireflyE, reply 4


While the defense side of things is not possible, the offense side of things is basically done in the swarm bonus.

 

That was not exactly what I was looking for though, as swarm bonus applies when your allies are adjacent to the enemy you target. So they're not necessarily adjacent to the attacking unit. On the other side, my trait could give a damage bonus to the attacking unit even when the adjacent ally is not near the attacked enemy.