WarUnitTrigger 부분 재정리
This commit is contained in:
@@ -3,77 +3,8 @@ import type { GeneralStatName, WarStatName } from '@sammo-ts/logic/triggers/type
|
||||
import type { WarActionContext } from '@sammo-ts/logic/war/actions.js';
|
||||
import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js';
|
||||
import { TraitRequirement, TraitWeightType } from '../requirements.js';
|
||||
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
import { LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
|
||||
class che_격노시도 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 30400);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (!oppose.hasActivatedSkill('필살') && !oppose.hasActivatedSkill('회피')) {
|
||||
return true;
|
||||
}
|
||||
if (self.hasActivatedSkill('격노불가')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (oppose.hasActivatedSkill('필살')) {
|
||||
self.activateSkill('격노');
|
||||
oppose.deactivateSkill('회피');
|
||||
if (self.isAttacker() && self.rng.nextBool(1 / 2)) {
|
||||
self.activateSkill('진노');
|
||||
}
|
||||
} else if (self.rng.nextBool(1 / 4)) {
|
||||
self.activateSkill('격노');
|
||||
oppose.deactivateSkill('회피');
|
||||
if (self.isAttacker() && self.rng.nextBool(1 / 2)) {
|
||||
self.activateSkill('진노');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class che_격노발동 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 40600);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (!self.hasActivatedSkill('격노')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const targetAct = oppose.hasActivatedSkill('필살') ? '필살 공격' : '회피 시도';
|
||||
const is진노 = self.hasActivatedSkill('진노');
|
||||
const reaction = is진노 ? '진노' : '격노';
|
||||
|
||||
self.getLogger().pushGeneralBattleDetailLog(`상대의 ${targetAct}에 <C>${reaction}</>했다!</>`, LogFormat.PLAIN);
|
||||
oppose
|
||||
.getLogger()
|
||||
.pushGeneralBattleDetailLog(`${targetAct}에 상대가 <R>${reaction}</>했다!</>`, LogFormat.PLAIN);
|
||||
|
||||
if (is진노) {
|
||||
self.addBonusPhase(1);
|
||||
}
|
||||
self.multiplyWarPowerMultiply(self.criticalDamage());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { che_격노발동, che_격노시도 } from '@sammo-ts/logic/war/triggers/che_격노.js';
|
||||
|
||||
function onCalcStat(context: GeneralActionContext, statName: GeneralStatName, value: number, aux?: unknown): number;
|
||||
function onCalcStat(
|
||||
|
||||
@@ -3,24 +3,8 @@ import type { GeneralStatName, WarStatName } from '@sammo-ts/logic/triggers/type
|
||||
import type { WarActionContext } from '@sammo-ts/logic/war/actions.js';
|
||||
import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js';
|
||||
import { TraitRequirement, TraitWeightType } from '../requirements.js';
|
||||
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
class che_부상무효 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 10200);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
_oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
self.activateSkill('부상무효');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { che_부상무효 } from '@sammo-ts/logic/war/triggers/che_견고.js';
|
||||
|
||||
function onCalcStat(context: GeneralActionContext, statName: GeneralStatName, value: number, aux?: unknown): number;
|
||||
function onCalcStat(
|
||||
|
||||
@@ -3,40 +3,8 @@ import type { GeneralActionContext } from '@sammo-ts/logic/triggers/general.js';
|
||||
import type { GeneralStatName, WarStatName } from '@sammo-ts/logic/triggers/types.js';
|
||||
import type { WarActionContext } from '@sammo-ts/logic/war/actions.js';
|
||||
import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js';
|
||||
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
class che_돌격지속 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 40900);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (oppose.constructor.name === 'WarUnitCity') {
|
||||
return true;
|
||||
}
|
||||
if (!self.isAttacker()) {
|
||||
return true;
|
||||
}
|
||||
const attackCoef = self.getCrewType().getAttackCoef(oppose.getCrewType());
|
||||
if (attackCoef < 1) {
|
||||
if (oppose.hasActivatedSkill('선제') && self.getPhase() >= self.getMaxPhase() - 2) {
|
||||
self.addBonusPhase(-1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (self.getPhase() < self.getMaxPhase() - 1) {
|
||||
return true;
|
||||
}
|
||||
self.addBonusPhase(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { che_돌격지속 } from '@sammo-ts/logic/war/triggers/che_돌격.js';
|
||||
|
||||
function onCalcStat(context: GeneralActionContext, statName: GeneralStatName, value: number, aux?: unknown): number;
|
||||
function onCalcStat(
|
||||
|
||||
@@ -3,75 +3,8 @@ import type { GeneralStatName, WarStatName } from '@sammo-ts/logic/triggers/type
|
||||
import type { WarActionContext } from '@sammo-ts/logic/war/actions.js';
|
||||
import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js';
|
||||
import { TraitRequirement, TraitWeightType } from '../requirements.js';
|
||||
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
import { LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
|
||||
class che_반계시도 extends BaseWarUnitTrigger {
|
||||
private readonly prob: number;
|
||||
|
||||
constructor(unit: WarUnit, prob = 0.4) {
|
||||
super(unit, 30300);
|
||||
this.prob = prob;
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (!oppose.hasActivatedSkill('계략')) {
|
||||
return true;
|
||||
}
|
||||
if (self.hasActivatedSkill('반계불가')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!self.rng.nextBool(this.prob)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
self.activateSkill('반계');
|
||||
oppose.deactivateSkill('계략');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class che_반계발동 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 40250);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (!self.hasActivatedSkill('반계')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const magicData = opposeEnv.magic as [string, number] | undefined;
|
||||
if (!magicData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const [opposeMagic, damage] = magicData;
|
||||
|
||||
self.getLogger().pushGeneralBattleDetailLog(
|
||||
`<C>반계</>로 상대의 <D>${opposeMagic}</>을 되돌렸다!`,
|
||||
LogFormat.PLAIN
|
||||
);
|
||||
oppose.getLogger().pushGeneralBattleDetailLog(`<D>${opposeMagic}</>을 <R>역으로</> 당했다!`, LogFormat.PLAIN);
|
||||
|
||||
self.multiplyWarPowerMultiply(damage);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { che_반계발동, che_반계시도 } from '@sammo-ts/logic/war/triggers/che_반계.js';
|
||||
|
||||
function onCalcStat(context: GeneralActionContext, statName: GeneralStatName, value: number, aux?: unknown): number;
|
||||
function onCalcStat(
|
||||
|
||||
@@ -3,64 +3,8 @@ import type { GeneralStatName, WarStatName } from '@sammo-ts/logic/triggers/type
|
||||
import type { WarActionContext } from '@sammo-ts/logic/war/actions.js';
|
||||
import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js';
|
||||
import { TraitRequirement, TraitWeightType } from '../requirements.js';
|
||||
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
import { LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
|
||||
type AtmosUnit = WarUnit & { addAtmos: (amount: number) => void };
|
||||
|
||||
const canAddAtmos = (unit: WarUnit): unit is AtmosUnit =>
|
||||
'addAtmos' in unit && typeof (unit as { addAtmos?: unknown }).addAtmos === 'function';
|
||||
|
||||
class che_위압시도 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 10100);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (self.getPhase() !== 0 && oppose.getPhase() !== 0) {
|
||||
return true;
|
||||
}
|
||||
if (self.hasActivatedSkill('위압불가')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
self.activateSkill('위압');
|
||||
oppose.activateSkill('회피불가', '필살불가', '계략불가');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class che_위압발동 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 40700);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (!self.hasActivatedSkill('위압')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('상대에게 <R>위압</>받았다!', LogFormat.PLAIN);
|
||||
self.getLogger().pushGeneralBattleDetailLog('상대에게 <C>위압</>을 줬다!', LogFormat.PLAIN);
|
||||
oppose.setWarPowerMultiply(0);
|
||||
if (canAddAtmos(oppose)) {
|
||||
oppose.addAtmos(-5);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { che_위압발동, che_위압시도 } from '@sammo-ts/logic/war/triggers/che_위압.js';
|
||||
|
||||
function onCalcStat(context: GeneralActionContext, statName: GeneralStatName, value: number, aux?: unknown): number;
|
||||
function onCalcStat(
|
||||
|
||||
@@ -4,101 +4,7 @@ import type { WarActionContext } from '@sammo-ts/logic/war/actions.js';
|
||||
import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js';
|
||||
import { TraitRequirement, TraitWeightType } from '../requirements.js';
|
||||
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
import { LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
|
||||
type AtmosUnit = WarUnit & { addAtmos: (amount: number) => void };
|
||||
|
||||
const canAddAtmos = (unit: WarUnit): unit is AtmosUnit =>
|
||||
'addAtmos' in unit && typeof (unit as { addAtmos?: unknown }).addAtmos === 'function';
|
||||
|
||||
class che_저격시도 extends BaseWarUnitTrigger {
|
||||
private readonly ratio: number;
|
||||
private readonly woundMin: number;
|
||||
private readonly woundMax: number;
|
||||
private readonly addAtmos: number;
|
||||
|
||||
constructor(unit: WarUnit, ratio: number, woundMin: number, woundMax: number, addAtmos = 20) {
|
||||
super(unit, 20100);
|
||||
this.ratio = ratio;
|
||||
this.woundMin = woundMin;
|
||||
this.woundMax = woundMax;
|
||||
this.addAtmos = addAtmos;
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (self.getPhase() !== 0 && oppose.getPhase() !== 0) {
|
||||
return true;
|
||||
}
|
||||
if (oppose.getPhase() < 0) {
|
||||
return true;
|
||||
}
|
||||
if (self.hasActivatedSkill('저격')) {
|
||||
return true;
|
||||
}
|
||||
if (self.hasActivatedSkill('저격불가')) {
|
||||
return true;
|
||||
}
|
||||
if (!self.rng.nextBool(this.ratio)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
self.activateSkill('저격');
|
||||
selfEnv['저격발동자'] = this.raiseType;
|
||||
selfEnv['woundMin'] = this.woundMin;
|
||||
selfEnv['woundMax'] = this.woundMax;
|
||||
selfEnv['addAtmos'] = this.addAtmos;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class che_저격발동 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 40100);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (!self.hasActivatedSkill('저격')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (((selfEnv['저격발동자'] as number) ?? -1) !== this.raiseType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((selfEnv['저격발동'] as boolean) ?? false) {
|
||||
return true;
|
||||
}
|
||||
selfEnv['저격발동'] = true;
|
||||
|
||||
if (oppose.constructor.name === 'WarUnitGeneral') {
|
||||
self.getLogger().pushGeneralActionLog('상대를 <C>저격</>했다!', LogFormat.PLAIN);
|
||||
self.getLogger().pushGeneralBattleDetailLog('상대를 <C>저격</>했다!', LogFormat.PLAIN);
|
||||
oppose.getLogger().pushGeneralActionLog('상대에게 <R>저격</>당했다!', LogFormat.PLAIN);
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('상대에게 <R>저격</>당했다!', LogFormat.PLAIN);
|
||||
} else {
|
||||
self.getLogger().pushGeneralActionLog('성벽 수비대장을 <C>저격</>했다!', LogFormat.PLAIN);
|
||||
self.getLogger().pushGeneralBattleDetailLog('성벽 수비대장을 <C>저격</>했다!', LogFormat.PLAIN);
|
||||
}
|
||||
|
||||
if (canAddAtmos(self)) {
|
||||
self.addAtmos(selfEnv['addAtmos'] as number);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { che_저격발동, che_저격시도 } from '@sammo-ts/logic/war/triggers/che_저격.js';
|
||||
|
||||
function onCalcStat(context: GeneralActionContext, statName: GeneralStatName, value: number, aux?: unknown): number;
|
||||
function onCalcStat(
|
||||
@@ -130,7 +36,10 @@ export const traitModule: TraitModule = {
|
||||
},
|
||||
getBattlePhaseTriggerList: (_context) => {
|
||||
if (!_context.unit) return null;
|
||||
return new WarTriggerCaller(new che_저격시도(_context.unit, 0.5, 20, 40, 20), new che_저격발동(_context.unit));
|
||||
return new WarTriggerCaller(
|
||||
new che_저격시도(_context.unit, BaseWarUnitTrigger.TYPE_NONE, 0.5, 20, 40, 20),
|
||||
new che_저격발동(_context.unit, BaseWarUnitTrigger.TYPE_NONE)
|
||||
);
|
||||
},
|
||||
onCalcStat,
|
||||
};
|
||||
|
||||
@@ -3,28 +3,8 @@ import type { GeneralStatName, WarStatName } from '@sammo-ts/logic/triggers/type
|
||||
import type { WarActionContext } from '@sammo-ts/logic/war/actions.js';
|
||||
import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js';
|
||||
import { TraitRequirement, TraitWeightType } from '../requirements.js';
|
||||
import { BaseWarUnitTrigger, WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
class che_필살강화_회피불가 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, 20150);
|
||||
}
|
||||
|
||||
protected actionWar(
|
||||
self: WarUnit,
|
||||
oppose: WarUnit,
|
||||
_selfEnv: Record<string, unknown>,
|
||||
_opposeEnv: Record<string, unknown>
|
||||
): boolean {
|
||||
if (!self.hasActivatedSkill('필살')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
oppose.activateSkill('회피불가');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
import { WarTriggerCaller } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { che_필살강화_회피불가 } from '@sammo-ts/logic/war/triggers/che_필살.js';
|
||||
|
||||
function onCalcStat(context: GeneralActionContext, statName: GeneralStatName, value: number, aux?: unknown): number;
|
||||
function onCalcStat(
|
||||
|
||||
Reference in New Issue
Block a user