18 lines
701 B
ActionScript
18 lines
701 B
ActionScript
|
namespace Gen7 {
|
||
|
[Move effect=SwapWithTarget]
|
||
|
shared class SwapWithTarget : PkmnScript {
|
||
|
void OnSecondaryEffect(ExecutingMove@ move, Pokemon@ target, uint8 hit) override {
|
||
|
auto userSide = move.User.BattleSide;
|
||
|
auto targetSide = target.BattleSide;
|
||
|
if (userSide !is targetSide){
|
||
|
move.GetHitData(target, hit).Fail();
|
||
|
return;
|
||
|
}
|
||
|
auto userIndex = userSide.GetPokemonIndex(move.User);
|
||
|
auto targetIndex = userSide.GetPokemonIndex(target);
|
||
|
if (!userSide.SwapPositions(userIndex, targetIndex)){
|
||
|
move.GetHitData(target, hit).Fail();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|