Make Opportunist/Mirror Herb copy Anger Point (#9341)

This commit is contained in:
Alexander B 2023-01-23 12:21:52 -06:00 committed by GitHub
parent f48c56e424
commit 2340b66d29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 6 deletions

View File

@ -122,8 +122,7 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
onHit(target, source, move) {
if (!target.hp) return;
if (move?.effectType === 'Move' && target.getMoveHitData(move).crit) {
target.setBoost({atk: 6});
this.add('-setboost', target, 'atk', 12, '[from] ability: Anger Point');
this.boost({atk: 12}, target, target);
}
},
name: "Anger Point",

View File

@ -1816,8 +1816,8 @@ export class Battle {
if (boostBy) {
success = true;
switch (effect?.id) {
case 'bellydrum':
this.add('-setboost', target, 'atk', target.boosts['atk'], '[from] move: Belly Drum');
case 'bellydrum': case 'angerpoint':
this.add('-setboost', target, 'atk', target.boosts['atk'], '[from] ' + effect.fullname);
break;
case 'bellydrum2':
this.add(msg, target, boostName, boostBy, '[silent]');

View File

@ -6,6 +6,8 @@ const common = require('./../../common');
let battle;
describe("Opportunist", () => {
afterEach(() => battle.destroy());
it("should not cause an infinite loop with itself", () => {
battle = common.createBattle([[
{species: 'Espathra', ability: 'Opportunist', moves: ['calmmind']},
@ -13,7 +15,29 @@ describe("Opportunist", () => {
{species: 'Espathra', ability: 'Opportunist', moves: ['sleeptalk']},
]]);
battle.makeChoices();
assert.equal(battle.p1.active[0].boosts.spa, 1);
assert.equal(battle.p2.active[0].boosts.spa, 1);
assert.statStage(battle.p1.active[0], 'spa', 1);
assert.statStage(battle.p2.active[0], 'spa', 1);
});
it("should copy Anger Point", () => {
battle = common.createBattle([[
{species: 'Espathra', ability: 'Opportunist', moves: ['stormthrow']},
], [
{species: 'Primeape', ability: 'Anger Point', moves: ['sleeptalk']},
]]);
battle.makeChoices();
assert.statStage(battle.p1.active[0], 'atk', 6);
});
it("should only copy the effective boost after the +6 cap", () => {
battle = common.createBattle({gameType: 'doubles'}, [[
{species: 'Espathra', ability: 'Opportunist', moves: ['sleeptalk']},
{species: 'Froslass', ability: 'Snow Cloak', moves: ['frostbreath']},
], [
{species: 'Primeape', ability: 'Anger Point', moves: ['sleeptalk']},
{species: 'Gyarados', ability: 'Intimidate', moves: ['sleeptalk']},
]]);
battle.makeChoices();
assert.statStage(battle.p1.active[0], 'atk', -1 + 6);
});
});