forked from smogon/pokemon-showdown
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
11 changed files
with
760 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTable = { | ||
aftermath: { | ||
inherit: true, | ||
onDamagingHit(damage, target, source, move) { | ||
if (!target.hp && this.checkMoveMakesContact(move, source, target, true)) { | ||
const calc = calculate(this, target, source); | ||
this.damage(calc * source.baseMaxhp / 4, source, target); | ||
} | ||
}, | ||
}, | ||
baddreams: { | ||
inherit: true, | ||
onResidual(pokemon) { | ||
if (!pokemon.hp) return; | ||
for (const target of pokemon.foes()) { | ||
if (target.status === 'slp' || target.hasAbility('comatose')) { | ||
const calc = calculate(this, pokemon, target); | ||
this.damage(calc * target.baseMaxhp / 8, target, pokemon); | ||
} | ||
} | ||
}, | ||
}, | ||
gulpmissile: { | ||
inherit: true, | ||
onDamagingHit(damage, target, source, move) { | ||
if (!source.hp || !source.isActive || target.isSemiInvulnerable()) return; | ||
if (['cramorantgulping', 'cramorantgorging'].includes(target.species.id)) { | ||
const calc = calculate(this, target, source); | ||
if (calc) this.damage(calc * source.baseMaxhp / 4, source, target); | ||
if (target.species.id === 'cramorantgulping') { | ||
this.boost({def: -1}, source, target, null, true); | ||
} else { | ||
source.trySetStatus('par', target, move); | ||
} | ||
target.formeChange('cramorant', move); | ||
} | ||
}, | ||
}, | ||
ironbarbs: { | ||
inherit: true, | ||
onDamagingHit(damage, target, source, move) { | ||
if (this.checkMoveMakesContact(move, source, target, true)) { | ||
const calc = calculate(this, target, source); | ||
this.damage(calc * source.baseMaxhp / 8, source, target); | ||
} | ||
}, | ||
}, | ||
roughskin: { | ||
inherit: true, | ||
onDamagingHit(damage, target, source, move) { | ||
if (this.checkMoveMakesContact(move, source, target, true)) { | ||
const calc = calculate(this, target, source); | ||
this.damage(calc * source.baseMaxhp / 8, source, target); | ||
} | ||
}, | ||
}, | ||
}; | ||
|
||
function calculate(battle: Battle, source: Pokemon, pokemon: Pokemon) { | ||
const move = battle.dex.getActiveMove('tackle'); | ||
move.type = source.getTypes()[0]; | ||
const typeMod = Math.pow(2, battle.clampIntRange(pokemon.runEffectiveness(move), -6, 6)); | ||
if (!pokemon.runImmunity(move.type)) return 0; | ||
return typeMod; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDataTable = { | ||
tox: { | ||
inherit: true, | ||
onResidual(pokemon) { | ||
if (this.effectState.stage < 15) { | ||
this.effectState.stage++; | ||
} | ||
const calc = calculate(this, this.effectState.source, pokemon); | ||
this.damage(calc * this.clampIntRange(pokemon.baseMaxhp / 16, 1) * this.effectState.stage); | ||
}, | ||
}, | ||
brn: { | ||
inherit: true, | ||
onResidual(pokemon) { | ||
const calc = calculate(this, this.effectState.source, pokemon); | ||
this.damage(calc * pokemon.baseMaxhp / 16); | ||
}, | ||
}, | ||
psn: { | ||
inherit: true, | ||
onResidual(pokemon) { | ||
const calc = calculate(this, this.effectState.source, pokemon); | ||
this.damage(calc * pokemon.baseMaxhp / 8); | ||
}, | ||
}, | ||
partiallytrapped: { | ||
inherit: true, | ||
onResidual(pokemon) { | ||
const source = this.effectState.source; | ||
// G-Max Centiferno and G-Max Sandblast continue even after the user leaves the field | ||
const gmaxEffect = ['gmaxcentiferno', 'gmaxsandblast'].includes(this.effectState.sourceEffect.id); | ||
if (source && (!source.isActive || source.hp <= 0 || !source.activeTurns) && !gmaxEffect) { | ||
delete pokemon.volatiles['partiallytrapped']; | ||
this.add('-end', pokemon, this.effectState.sourceEffect, '[partiallytrapped]', '[silent]'); | ||
return; | ||
} | ||
const calc = calculate(this, source, pokemon); | ||
this.damage(calc * pokemon.baseMaxhp / this.effectState.boundDivisor); | ||
}, | ||
}, | ||
sandstorm: { | ||
inherit: true, | ||
onWeather(target) { | ||
const calc = calculate(this, this.effectState.source, target); | ||
this.damage(calc * target.baseMaxhp / 16); | ||
}, | ||
}, | ||
}; | ||
|
||
function calculate(battle: Battle, source: Pokemon, pokemon: Pokemon) { | ||
const move = battle.dex.getActiveMove('tackle'); | ||
move.type = source.getTypes()[0]; | ||
const typeMod = Math.pow(2, battle.clampIntRange(pokemon.runEffectiveness(move), -6, 6)); | ||
if (!pokemon.runImmunity(move.type)) return 0; | ||
return typeMod; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
export const Items: import('../../../sim/dex-items').ModdedItemDataTable = { | ||
blacksludge: { | ||
inherit: true, | ||
onResidual(pokemon) { | ||
if (pokemon.hasType('Poison')) { | ||
this.heal(pokemon.baseMaxhp / 16); | ||
} else { | ||
const calc = calculate(this, pokemon, pokemon); | ||
if (calc) this.damage(calc * pokemon.baseMaxhp / 8); | ||
} | ||
}, | ||
}, | ||
jabocaberry: { | ||
inherit: true, | ||
onDamagingHit(damage, target, source, move) { | ||
if (move.category === 'Physical' && source.hp && source.isActive && !source.hasAbility('magicguard')) { | ||
if (target.eatItem()) { | ||
const calc = calculate(this, target, source); | ||
if (calc) this.damage(calc * source.baseMaxhp / (target.hasAbility('ripen') ? 4 : 8), source, target); | ||
} | ||
} | ||
}, | ||
}, | ||
lifeorb: { | ||
inherit: true, | ||
onAfterMoveSecondarySelf(source, target, move) { | ||
if (source && source !== target && move && move.category !== 'Status' && !source.forceSwitchFlag) { | ||
const calc = calculate(this, source, source); | ||
if (calc) this.damage(calc * source.baseMaxhp / 10, source, source, this.dex.items.get('lifeorb')); | ||
} | ||
}, | ||
}, | ||
rockyhelmet: { | ||
inherit: true, | ||
onDamagingHit(damage, target, source, move) { | ||
if (this.checkMoveMakesContact(move, source, target)) { | ||
const calc = calculate(this, target, source); | ||
if (calc) this.damage(calc * source.baseMaxhp / 6, source, target); | ||
} | ||
}, | ||
}, | ||
rowapberry: { | ||
inherit: true, | ||
onDamagingHit(damage, target, source, move) { | ||
if (move.category === 'Special' && source.hp && source.isActive && !source.hasAbility('magicguard')) { | ||
if (target.eatItem()) { | ||
const calc = calculate(this, target, source); | ||
if (calc) this.damage(calc * source.baseMaxhp / (target.hasAbility('ripen') ? 4 : 8), source, target); | ||
} | ||
} | ||
}, | ||
}, | ||
stickybarb: { | ||
inherit: true, | ||
onResidual(pokemon) { | ||
const calc = calculate(this, pokemon, pokemon); | ||
if (calc) this.damage(calc * pokemon.baseMaxhp / 8); | ||
}, | ||
}, | ||
}; | ||
|
||
function calculate(battle: Battle, source: Pokemon, pokemon: Pokemon) { | ||
const move = battle.dex.getActiveMove('tackle'); | ||
move.type = source.getTypes()[0]; | ||
const typeMod = Math.pow(2, battle.clampIntRange(pokemon.runEffectiveness(move), -6, 6)); | ||
if (!pokemon.runImmunity(move.type)) return 0; | ||
return typeMod; | ||
} |
Oops, something went wrong.