Could this work in fight.defend.capital for ex for DO without any performance impact?
Code: Select all
<handler>
<conditions>
<event_object_destroyed object="$attacker" />
<check_value value="this.ship.owner == faction.player" />
<check_value value="event.object.isclass.ship and (not event.object.isclass.ship_xs)" />
<check_value value="event.object.owner != faction.player" />
<check_value value="event.param == this.ship" />
</conditions>
<actions>
<set_value name="$IncChance" exact="0" />
<do_if value="@$attacker.isclass.ship_xl">
<set_value name="$IncChance" exact="25" />
</do_if>
<do_if value="@$attacker.isclass.ship_l">
<set_value name="$IncChance" exact="10" />
</do_if>
<do_if value="@$attacker.isclass.ship_m">
<set_value name="$IncChance" exact="2" />
</do_if>
<do_if value="@$attacker.isclass.ship_s">
<set_value name="$IncChance" exact="1" />
</do_if>
<do_if value="true" chance="$incChance">
<do_any>
<do_if value="this.skills.combat lt 5" weight="40">
<set_value name="this.skill.combat" operation="add" />
</do_if>
<do_if value="this.skills.leadership lt 5" weight="30">
<set_value name="this.skill.leadership" operation="add" />
</do_if>
<do_if value="this.skills.morale lt 5" weight="30">
<set_value name="this.skill.morale" operation="add" />
</do_if>
</do_any>
</do_if>
</actions>
</handler>
$attacker is just a local that doesnt even exist usually.
Captain could be in move.generic only perhaps, when target is reached (before the <break />) with a 1% chance or so.
Engineer when any component is repaired to max allowed hp.