更新
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Character;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
|
||||
namespace Continentis.Mods.Basic.Buffs
|
||||
{
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Character;
|
||||
using SLSUtilities.General;
|
||||
|
||||
namespace Continentis.Mods.Basic.Buffs
|
||||
{
|
||||
/// <summary>
|
||||
/// 筑城(Fortification)Buff:
|
||||
/// 每回合首次行动开始时,获得等同于 Firm Buff Stack层数 * Fortification Buff Stack层数的格挡。
|
||||
/// 前后施加层数会合并叠加。
|
||||
/// </summary>
|
||||
public class Fortification : CharacterCombatBuffBase
|
||||
{
|
||||
public Fortification(int stack)
|
||||
{
|
||||
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
|
||||
|
||||
this.contentSubmodule = new ContentSubmodule(this)
|
||||
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
|
||||
|
||||
this.iconSubmodule = new IconSubmodule(this);
|
||||
|
||||
// 无限持续时间 (-1),支持层数叠加
|
||||
this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack, false);
|
||||
|
||||
this.eventSubmodule = new EventSubmodule(this);
|
||||
this.eventSubmodule.onActionStart.InsertByPriority("Fortification_Block", new PrioritizedAction(() =>
|
||||
{
|
||||
if (attachedCharacter.actionCountThisRound == 0) // 每个回合首次行动开始时
|
||||
{
|
||||
if (attachedCharacter.combatBuffSubmodule.TryGetBuff<Firm>(out var firmBuff))
|
||||
{
|
||||
int firmStack = firmBuff.unitedStackSubmodule.stackAmount;
|
||||
if (firmStack > 0)
|
||||
{
|
||||
int blockGain = firmStack * this.unitedStackSubmodule.stackAmount;
|
||||
attachedCharacter.AddBlock(blockGain);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||||
{
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText("Fortification", attachedCharacter.characterView);
|
||||
|
||||
if (FindExistingSameBuff(out existingBuff))
|
||||
{
|
||||
// 新的层数直接叠加到原有的Buff上
|
||||
existingBuff.unitedStackSubmodule.AddStack(this.unitedStackSubmodule.stackAmount);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76c520de73e71d646a7f0315f5f1055f
|
||||
@@ -1,7 +1,7 @@
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Character;
|
||||
using Continentis.MainGame.Combat;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.Mods.Basic.Buffs
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Character;
|
||||
using SLSUtilities.General;
|
||||
|
||||
namespace Continentis.Mods.Basic.Buffs
|
||||
{
|
||||
/// <summary>
|
||||
/// 圣盾(骑士):免疫下一次受到的伤害(不论伤害量)。
|
||||
/// 每次免疫消耗 1 层;响应式攻击和生命移除不触发免疫。
|
||||
/// </summary>
|
||||
public class HolyShield : CharacterCombatBuffBase
|
||||
{
|
||||
public HolyShield(int stack)
|
||||
{
|
||||
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
|
||||
|
||||
this.contentSubmodule = new ContentSubmodule(this)
|
||||
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
|
||||
|
||||
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions("Stack");
|
||||
|
||||
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
|
||||
|
||||
this.eventSubmodule = new EventSubmodule(this);
|
||||
this.eventSubmodule.onBeforeReceiveDamage.Add("HolyShield",
|
||||
new PrioritizedAction<IncomingDamageModifier>(OnBeforeReceiveDamage));
|
||||
}
|
||||
|
||||
private void OnBeforeReceiveDamage(IncomingDamageModifier modifier)
|
||||
{
|
||||
if (modifier.context.HasAnyTag(AttackTags.Reactive, AttackTags.HpRemoval)) return;
|
||||
if (unitedStackSubmodule.stackAmount <= 0) return;
|
||||
|
||||
modifier.isCancelled = true;
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText(
|
||||
contentSubmodule.displayName, attachedCharacter.characterView);
|
||||
|
||||
unitedStackSubmodule.ReduceStack(1);
|
||||
iconSubmodule.Update();
|
||||
}
|
||||
|
||||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||||
{
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText(
|
||||
contentSubmodule.displayName, attachedCharacter.characterView);
|
||||
|
||||
if (FindExistingSameBuff(out existingBuff))
|
||||
{
|
||||
existingBuff.unitedStackSubmodule.AddStack(this.unitedStackSubmodule.stackAmount);
|
||||
return false;
|
||||
}
|
||||
|
||||
existingBuff = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63c25c7a416c9654dac77a6f840ffc15
|
||||
77
Assets/Mods/Basic/Characters/CombatBuffs/Knight/Vengeance.cs
Normal file
77
Assets/Mods/Basic/Characters/CombatBuffs/Knight/Vengeance.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame;
|
||||
using Continentis.MainGame.Card;
|
||||
using Continentis.MainGame.Character;
|
||||
using SLSUtilities.General;
|
||||
|
||||
namespace Continentis.Mods.Basic.Buffs
|
||||
{
|
||||
/// <summary>
|
||||
/// 复仇(骑士):必须先持有此 Buff,之后每次被攻击叠加 1 层。
|
||||
/// 使用攻击类卡牌时,消耗所有层数对所有目标各造成等量的额外物理伤害。
|
||||
/// </summary>
|
||||
public class Vengeance : CharacterCombatBuffBase
|
||||
{
|
||||
public Vengeance()
|
||||
{
|
||||
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
|
||||
|
||||
this.contentSubmodule = new ContentSubmodule(this)
|
||||
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
|
||||
|
||||
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions("Stack");
|
||||
|
||||
// 初始 0 层;层数完全由事件驱动累积
|
||||
this.unitedStackSubmodule = new UnitedStackSubmodule(this, 0);
|
||||
|
||||
this.eventSubmodule = new EventSubmodule(this);
|
||||
|
||||
// 被攻击时叠层(过滤响应式和生命移除,防止递归)
|
||||
this.eventSubmodule.onGetAttacked.Add("Vengeance_Stack", new PrioritizedAction<AttackResult>(result =>
|
||||
{
|
||||
if (result.context.HasAnyTag(AttackTags.Reactive, AttackTags.HpRemoval)) return;
|
||||
unitedStackSubmodule.AddStack(1);
|
||||
iconSubmodule.Update();
|
||||
}));
|
||||
|
||||
// 打出攻击类卡牌时消耗所有层数造成额外伤害
|
||||
this.eventSubmodule.onAfterPlayCard.Add("Vengeance_Consume",
|
||||
new PrioritizedAction<CardInstance, List<CharacterBase>>(OnAfterPlayCard));
|
||||
}
|
||||
|
||||
private void OnAfterPlayCard(CardInstance playedCard, List<CharacterBase> targets)
|
||||
{
|
||||
if (!playedCard.HasKeyword("Attack")) return;
|
||||
if (unitedStackSubmodule.stackAmount <= 0) return;
|
||||
|
||||
int bonus = unitedStackSubmodule.stackAmount;
|
||||
unitedStackSubmodule.ModifyStack(-bonus);
|
||||
iconSubmodule.Update();
|
||||
|
||||
var ctx = new AttackContext()
|
||||
.WithTag(AttackTags.Reactive)
|
||||
.WithTag(AttackTags.GuaranteedHit)
|
||||
.WithDamageKeywords("Physics");
|
||||
|
||||
foreach (CharacterBase target in targets)
|
||||
{
|
||||
EnqueueReaction(Cmd.Do(() => attachedCharacter.Attack(target, bonus, ctx)));
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||||
{
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText(
|
||||
contentSubmodule.displayName, attachedCharacter.characterView);
|
||||
|
||||
// 若已存在则保留现有实例(不重置层数,不二次叠加)
|
||||
if (FindExistingSameBuff(out existingBuff))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
existingBuff = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93f911942e31e5f4b82ee210884abbd0
|
||||
Reference in New Issue
Block a user