Implements ColorChange
This commit is contained in:
15
Scripts/Abilities/ColorChange.as
Normal file
15
Scripts/Abilities/ColorChange.as
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Gen7 {
|
||||
[Ability effect=ColorChange]
|
||||
class ColorChange : PkmnScript {
|
||||
void OnIncomingHit(ExecutingMove@ move, Pokemon@ target, uint8 hit) override{
|
||||
// Color Change now activates after the last hit of a multi-strike move.
|
||||
if (move.NumberOfHits - 1 != hit)
|
||||
return;
|
||||
// Color Change does not activate if the Pokémon is hit by a move of the same type as itself, even if the Pokémon is dual-typed
|
||||
if (!target.HasType(move.UseMove.Type)){
|
||||
// Color Change will change the Pokémon's own type to the type of the move that it was hit by
|
||||
target.SetType(0, move.UseMove.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user