Skip to content

Commit

Permalink
Fix thaw mechanics in all gens
Browse files Browse the repository at this point in the history
- Gen 5-6: Thaw check is skipped when using a self-thaw move
- Gen 3-4: Thaw check happens before a move is used
- Gen 2: Self-thawing does not happen if the move misses
  • Loading branch information
Marty-D committed Apr 3, 2015
1 parent 844bad6 commit 3742d84
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
9 changes: 8 additions & 1 deletion data/statuses.js
Expand Up @@ -78,13 +78,20 @@ exports.BattleStatuses = {
},
onBeforeMovePriority: 10,
onBeforeMove: function (pokemon, target, move) {
if (move.thawsUser || this.random(5) === 0) {
if (move.thawsUser) return;
if (this.random(5) === 0) {
pokemon.cureStatus();
return;
}
this.add('cant', pokemon, 'frz');
return false;
},
onModifyMove: function (move, pokemon) {
if (move.thawsUser) {
this.add('-curestatus', pokemon, 'frz', '[from] move: ' + move);
pokemon.setStatus('');
}
},
onHit: function (target, source, move) {
if (move.thawsTarget || move.type === 'Fire' && move.category !== 'Status') {
target.cureStatus();
Expand Down
5 changes: 3 additions & 2 deletions mods/gen2/statuses.js
Expand Up @@ -28,7 +28,7 @@ exports.BattleStatuses = {
// 1-5 turns
this.effectData.time = this.random(2, 6);
},
onBeforeMovePriority: 2,
onBeforeMovePriority: 10,
onBeforeMove: function (pokemon, target, move) {
pokemon.statusData.time--;
if (pokemon.statusData.time <= 0) {
Expand All @@ -49,7 +49,8 @@ exports.BattleStatuses = {
this.add('cant', pokemon, 'frz');
return false;
},
onAfterMoveSelf: function (pokemon, target, move) {
onModifyMove: function () {},
onAfterMoveSecondarySelf: function (pokemon, target, move) {
if (move.thawsUser) pokemon.cureStatus();
},
onResidual: function (pokemon) {
Expand Down
13 changes: 5 additions & 8 deletions mods/gen3/statuses.js
Expand Up @@ -6,7 +6,7 @@ exports.BattleStatuses = {
// 1-4 turns
this.effectData.time = this.random(2, 6);
},
onBeforeMovePriority: 2,
onBeforeMovePriority: 10,
onBeforeMove: function (pokemon, target, move) {
if (pokemon.hasAbility('earlybird')) {
pokemon.statusData.time--;
Expand All @@ -24,21 +24,18 @@ exports.BattleStatuses = {
}
},
frz: {
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'frz');
},
onBeforeMovePriority: 2,
inherit: true,
onBeforeMove: function (pokemon, target, move) {
if (move.thawsUser || this.random(5) === 0) {
if (this.random(5) === 0) {
pokemon.cureStatus();
return;
}
if (move.thawsUser) return;
this.add('cant', pokemon, 'frz');
return false;
},
onHit: function (target, source, move) {
if (move.thawsTarget || move.type === 'Fire' && move.category !== 'Status' && move.id !== 'hiddenpower') {
if (move.thawsTarget || move.type === 'Fire' && move.category !== 'Status' && move.id !== 'hiddenpower' && move.id !== 'weatherball') {
target.cureStatus();
}
}
Expand Down
12 changes: 12 additions & 0 deletions mods/gen4/statuses.js
Expand Up @@ -32,6 +32,18 @@ exports.BattleStatuses = {
return false;
}
},
frz: {
inherit: true,
onBeforeMove: function (pokemon, target, move) {
if (this.random(5) === 0) {
pokemon.cureStatus();
return;
}
if (move.thawsUser) return;
this.add('cant', pokemon, 'frz');
return false;
}
},
trapped: {
inherit: true,
noCopy: false
Expand Down

0 comments on commit 3742d84

Please sign in to comment.