Implement crew type execution model
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { TriggerPriority } from '@sammo-ts/logic/triggers/core.js';
|
||||
import { BaseWarUnitTrigger } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { WarUnitCity, type WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
export class che_기병병종전투 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, TriggerPriority.Final + 100);
|
||||
}
|
||||
|
||||
protected actionWar(self: WarUnit, oppose: WarUnit): boolean {
|
||||
if (!self.isAttacker()) {
|
||||
oppose.multiplyWarPowerMultiply(1.02);
|
||||
self.multiplyWarPowerMultiply(0.97);
|
||||
} else if (oppose instanceof WarUnitCity) {
|
||||
self.multiplyWarPowerMultiply(0.9);
|
||||
} else {
|
||||
oppose.multiplyWarPowerMultiply(0.97);
|
||||
self.multiplyWarPowerMultiply(1.02);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TriggerPriority } from '@sammo-ts/logic/triggers/core.js';
|
||||
import { BaseWarUnitTrigger } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
export class che_방어력증가5p extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, TriggerPriority.Final + 200);
|
||||
}
|
||||
|
||||
protected actionWar(self: WarUnit, oppose: WarUnit): boolean {
|
||||
if (!self.isAttacker()) {
|
||||
oppose.multiplyWarPowerMultiply(1 / 1.05);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
import { TriggerPriority } from '@sammo-ts/logic/triggers/core.js';
|
||||
import { BaseWarUnitTrigger } from '@sammo-ts/logic/war/triggers.js';
|
||||
import type { WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
export class che_선제사격시도 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, TriggerPriority.Begin + 50);
|
||||
}
|
||||
|
||||
protected actionWar(self: WarUnit, oppose: WarUnit): boolean {
|
||||
if (self.getPhase() !== 0 && oppose.getPhase() !== 0) {
|
||||
return true;
|
||||
}
|
||||
if (self.hasActivatedSkill('선제') || self.hasActivatedSkillOnLog('선제')) {
|
||||
return true;
|
||||
}
|
||||
self.activateSkill('특수', '선제');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class che_선제사격발동 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, TriggerPriority.Begin + 51);
|
||||
}
|
||||
|
||||
protected actionWar(self: WarUnit, oppose: WarUnit): boolean {
|
||||
if (!self.hasActivatedSkill('선제')) {
|
||||
return true;
|
||||
}
|
||||
if (oppose.hasActivatedSkill('선제') && oppose.isAttacker()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
self.addPhase(-1);
|
||||
oppose.addPhase(-1);
|
||||
if (oppose.hasActivatedSkill('선제')) {
|
||||
self.multiplyWarPowerMultiply(2 / 3);
|
||||
oppose.multiplyWarPowerMultiply(2 / 3);
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('서로 <C>선제 사격</>을 주고 받았다!</>', LogFormat.PLAIN);
|
||||
self.getLogger().pushGeneralBattleDetailLog('서로 <C>선제 사격</>을 주고 받았다!</>', LogFormat.PLAIN);
|
||||
return true;
|
||||
}
|
||||
|
||||
oppose.multiplyWarPowerMultiply(0);
|
||||
self.multiplyWarPowerMultiply(2 / 3);
|
||||
self.activateSkill('회피불가', '필살불가', '계략불가');
|
||||
oppose.activateSkill('회피불가', '필살불가', '격노불가', '계략불가');
|
||||
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('상대에게 <R>선제 사격</>을 받았다!</>', LogFormat.PLAIN);
|
||||
self.getLogger().pushGeneralBattleDetailLog('상대에게 <C>선제 사격</>을 했다!</>', LogFormat.PLAIN);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { TriggerPriority } from '@sammo-ts/logic/triggers/core.js';
|
||||
import { BaseWarUnitTrigger } from '@sammo-ts/logic/war/triggers.js';
|
||||
import { WarUnitCity, WarUnitGeneral, type WarUnit } from '@sammo-ts/logic/war/units.js';
|
||||
|
||||
export class che_성벽부상무효 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit) {
|
||||
super(unit, TriggerPriority.Begin + 150);
|
||||
}
|
||||
|
||||
protected actionWar(self: WarUnit, oppose: WarUnit): boolean {
|
||||
if (!(self instanceof WarUnitGeneral) || !(oppose instanceof WarUnitCity)) {
|
||||
return true;
|
||||
}
|
||||
self.activateSkill('부상무효');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,18 @@ export class che_저지_시도 extends BaseWarUnitTrigger {
|
||||
constructor(unit: WarUnit, raiseType: number = 0) {
|
||||
super(unit, TriggerPriority.Pre, raiseType);
|
||||
}
|
||||
protected actionWar(u: WarUnit): boolean {
|
||||
u.activateSkill('특수', '저지');
|
||||
protected actionWar(self: WarUnit): boolean {
|
||||
if (!(self instanceof WarUnitGeneral) || self.isAttacker()) {
|
||||
return true;
|
||||
}
|
||||
if (self.hasActivatedSkill('특수') || self.hasActivatedSkill('저지불가')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const ratio = self.getComputedAtmos() + self.getComputedTrain();
|
||||
if (self.rng.nextBool(ratio / 400)) {
|
||||
self.activateSkill('특수', '저지');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +50,7 @@ export class che_저지 extends BaseWarUnitTrigger {
|
||||
}
|
||||
|
||||
self.getLogger().pushGeneralBattleDetailLog('상대를 <C>저지</>했다!', LogFormat.PLAIN);
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('<R>저지</>당했다!', LogFormat.PLAIN);
|
||||
oppose.getLogger().pushGeneralBattleDetailLog('저지</>당했다!', LogFormat.PLAIN);
|
||||
|
||||
const calcDamage = oppose.getWarPower() * 0.9;
|
||||
if (self instanceof WarUnitGeneral) {
|
||||
|
||||
Reference in New Issue
Block a user