Permalink
Browse files

Conversion implementation

  • Loading branch information...
1 parent c266367 commit a8ad279743e1b535f21d9c28672553ec94c0748d @TheImmortal TheImmortal committed May 19, 2012
Showing with 35 additions and 1 deletion.
  1. +35 −1 movedex.js
View
@@ -1663,8 +1663,42 @@ exports.BattleMovedex = {
name: "Conversion",
pp: 30,
priority: 0,
+ volatileStatus: 'conversion',
+ effect: {
+ onStart: function(pokemon) {
+ var possibleTypes = pokemon.moveset.map(function(val){
+ var move = this.getMove(val.id);
+ if (move.id !== 'conversion' && !pokemon.hasType(move.type)) {
+ return move.type;
+ }
+ }, this).compact();
+ if (!possibleTypes.length) {
+ this.add('-fail', pokemon);
+ return false;
+ }
+ this.effectData.type = possibleTypes.sample();
+ this.add('-start', pokemon, 'typechange', this.effectData.type);
+ },
+ onRestart: function(pokemon) {
+ var possibleTypes = pokemon.moveset.map(function(val){
+ var move = this.getMove(val.id);
+ if (move.id !== 'conversion' && !pokemon.hasType(move.type)) {
+ return move.type;
+ }
+ }, this).compact();
+ if (!possibleTypes.length) {
+ this.add('-fail', pokemon);
+ return false;
+ }
+ this.effectData.type = possibleTypes.sample();
+ this.add('-start', pokemon, 'typechange', this.effectData.type);
+ },
+ onModifyPokemon: function(pokemon) {
+ pokemon.types = [this.effectData.type];
+ }
+ },
secondary: false,
- target: "normal",
+ target: "self",
type: "Normal"
},
"conversion2": {

0 comments on commit a8ad279

Please sign in to comment.