36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "double_power_if_target_damaged_in_turn")]
|
|
public class DoublePowerIfTargetDamagedInTurn : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override void OnBeforeTurnStart(ITurnChoice choice)
|
|
{
|
|
if (choice is IMoveChoice moveChoice)
|
|
{
|
|
var battle = choice.User.BattleData?.Battle;
|
|
if (battle == null)
|
|
return;
|
|
var side = battle.Sides[moveChoice.TargetSide];
|
|
side.VolatileScripts.Add(new DoublePowerIfTargetDamagedInTurnData());
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
|
|
{
|
|
var battle = move.User.BattleData?.Battle;
|
|
if (battle == null)
|
|
return;
|
|
if (target.BattleData == null)
|
|
return;
|
|
var side = battle.Sides[target.BattleData.SideIndex];
|
|
var data = side.VolatileScripts.Get<DoublePowerIfTargetDamagedInTurnData>();
|
|
if (data == null)
|
|
return;
|
|
if (data._hitPokemon.Contains(target))
|
|
basePower *= 2;
|
|
}
|
|
} |