Skip to content

Commit

Permalink
fix(core): character defeated passive should trigger (genius-invokati…
Browse files Browse the repository at this point in the history
  • Loading branch information
guyutongxue authored Jan 20, 2025
1 parent 137e208 commit 9b808ce
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 25 deletions.
5 changes: 4 additions & 1 deletion packages/core/src/builder/skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,10 @@ export class TriggeredSkillBuilder<
// 【添加各种 filter】

// 0. 被动技能要求角色存活
if (this.parent._type === "character") {
if (
this.parent._type === "character" &&
this.detailedEventName !== "defeated"
) {
this.filters.push((c) => c.self.state.variables.alive);
}
// 1. 对于并非响应自身弃置的技能,当实体已经被弃置时,不再响应
Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/cards/event/food.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const [MatsutakeMeatRolls] = card(333014)
* 治疗目标角色1点,该角色接下来3次受到伤害后再治疗其1点。
* (每回合每个角色最多食用1次「料理」)
*/
export const [RainbowMacarons] = card(333015)
export const [RainbowMacarons, RainbowMacaronsInEffect] = card(333015)
.since("v4.6.0")
.costVoid(2)
.food({ extraTargetRestraint: "with health < maxHealth" })
Expand Down
37 changes: 14 additions & 23 deletions packages/data/src/characters/hydro/sigewinne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ export const Convalescence = combatStatus(112135)
.increaseDamage(1)
.done();

// 每层提高此角色的最大生命值1点。
const DetailedDiagnosisThoroughTreatmentStatus = status(112136)
.variableCanAppend("value", 1, Infinity)
.on("enter")
.do((c) => {
c.increaseMaxHealth(1, "@master");
})
// 所附属角色的生命之契完全移除后,提高此角色1点最大生命值。
export const DetailedDiagnosisThoroughTreatmentStatus = status(112136)
.on("dispose", (c, e) => e.entity.definition.id === BondOfLife)
.usage(3)
.increaseMaxHealth(1, "@master")
.done();

/**
Expand Down Expand Up @@ -158,20 +156,9 @@ export const SuperSaturatedSyringing = skill(12133)
* 我方切换到本角色时:如果我方场上存在源水之滴,则使其可用次数-1,本角色获得1点充能。
*/
export const DetailedDiagnosisThoroughTreatment01 = skill(12134)
.type("passive")
.variable("hasBondOfLife", 0)
.on("dispose", (c, e) => e.entity.definition.id === BondOfLife)
.listenToPlayer()
.do((c, e) => {
if (e.area.type !== "characters") {
return; // unreachable
}
const target = c.of<"character">(e.area.characterId);
const appended = target.hasStatus(DetailedDiagnosisThoroughTreatmentStatus)?.variables.value ?? 0;
if (appended < 3) {
c.characterStatus(DetailedDiagnosisThoroughTreatmentStatus, target.state);
}
})
.type("passive") // 希格雯入场时:为所有我方角色附属 112136
.on("enter")
.characterStatus(DetailedDiagnosisThoroughTreatmentStatus, "all my characters")
.done();

/**
Expand All @@ -181,7 +168,10 @@ export const DetailedDiagnosisThoroughTreatment01 = skill(12134)
*
*/
export const DetailedDiagnosisThoroughTreatment02 = skill(12136)
.reserve();
.type("passive") // 希格雯倒下时:清除所有我方 112136 状态
.on("defeated")
.dispose(`all my status with definition id ${DetailedDiagnosisThoroughTreatmentStatus}`)
.done();

/**
* @id 12137
Expand Down Expand Up @@ -212,7 +202,8 @@ export const Sigewinne = character(1213)
.tags("hydro", "bow", "fontaine", "pneuma")
.health(10)
.energy(2)
.skills(TargetedTreatment, ReboundHydrotherapy, SuperSaturatedSyringing, DetailedDiagnosisThoroughTreatment01, MedicalInterventionOfPureIntention, DetailedDiagnosisThoroughTreatment03)
.skills(TargetedTreatment, ReboundHydrotherapy, SuperSaturatedSyringing, DetailedDiagnosisThoroughTreatment01, MedicalInterventionOfPureIntention,
DetailedDiagnosisThoroughTreatment02, DetailedDiagnosisThoroughTreatment03)
.done();

/**
Expand Down
56 changes: 56 additions & 0 deletions packages/test/__tests__/sigewinne.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (C) 2025 Guyutongxue
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

import { Character, CombatStatus, ref, setup, State, Status } from "#test";
import { RainbowMacaronsInEffect } from "@gi-tcg/data/internal/cards/event/food";
import {
Keqing,
StellarRestoration,
YunlaiSwordsmanship,
} from "@gi-tcg/data/internal/characters/electro/keqing";
import {
DetailedDiagnosisThoroughTreatmentStatus,
Sigewinne,
} from "@gi-tcg/data/internal/characters/hydro/sigewinne";
import { BondOfLife, Satiated } from "@gi-tcg/data/internal/commons";
import { Aura } from "@gi-tcg/typings";
import { test } from "bun:test";

test("sigwinne: passive triggered after defeated", async () => {
const oppNext = ref();
const c = setup(
<State>
<Character opp active def={Sigewinne} health={1} aura={Aura.Cryo} />
<Character opp health={10} ref={oppNext}>
<Status def={DetailedDiagnosisThoroughTreatmentStatus} />
<Status def={BondOfLife} usage={1} />
<Status def={RainbowMacaronsInEffect} />
<Status def={Satiated} />
</Character>
<Character my active def={Keqing} />
</State>,
);
await c.me.skill(StellarRestoration);
// 超导后台穿透,oppNext 扣 1 血
// 马卡龙回 1 血但被生命之契吃掉(生命值 9)
// 生命之契弃置,触发希格雯被动,最大生命值+1
// 生命值 10,最大生命值 11
c.expect(oppNext).toHaveVariable({ health: 10, maxHealth: 11 });
c.expect(
`opp status with definition id ${DetailedDiagnosisThoroughTreatmentStatus}`,
).toNotExist();
await c.opp.chooseActive(oppNext);
c.expect("opp active").toBe(oppNext);
});

0 comments on commit 9b808ce

Please sign in to comment.