1.什么是超杀?
超杀机制是在拉斯塔哈的大乱斗版本中引入的,其效果就是使用卡牌所造成的伤害,大于(不能等于)被打击随从伤害前的生命值,即触发超杀。
2.超杀卡牌种类
目前有随从牌、法术牌、武器牌,需要分别实现
目前法术牌仅有3张,且获取卡牌所造成的伤害比较麻烦,所以不为超杀法术增加一个虚函数
3.超杀机制的识别
1.silverfish_HB.cs
getMinions()方法下:
m.Overkill= (entitiy.GetTag(GAME_TAG.OVERKILL) == 0) ? false : true;
在if (TritonHs.DoWeHaveWeapon)下添加
ownWeapon.Overkill = (weapon.GetTag(GAME_TAG.OVERKILL) == 1) ? true : false;
同理在if (TritonHs.DoesEnemyHasWeapon)下添加
enemyWeapon.Overkill = (weapon.GetTag(GAME_TAG.OVERKILL) == 1) ? true : false;
2.Minion.cs
Minion类中添加Overkill属性:
private bool _overkill = false; public bool Overkill { get => _overkill; set => _overkill = value; }
public Minion(Minion m)方法和public void setMinionToMinion(Minion m)方法:
this.Overkill = m.Overkill;
public void becomeSilence(Playfield p)方法:
Overkill = false;
3.CardDB.cs
同Minion.cs
如果编译失败,属性初始值应写为
private bool _overkill = false; /// <summary> /// 超杀 /// </summary> public bool Overkill { get { return _overkill; } set { _overkill = value; } }
构造函数中读取carddefs的地方:
case 923: c.Overkill = value == 1; break;//overkill
4.虚函数的增加
SimTemplate.cs:
/// <summary> /// 超杀效果(武器) /// </summary> /// <param name="p">场面</param> /// <param name="w">武器</param> public virtual void OnOverkill(Playfield p, Weapon w) { return; } /// <summary> /// 超杀效果(随从) /// </summary> /// <param name="p">场面</param> /// <param name="m">具有超杀效果的随从</param> public virtual void OnOverkill(Playfield p, Minion m) { return; }
5.超杀机制的实现
Playfiled.cs:
在minionAttacksMinion方法下:
在//defender gets dmg下添加
bool defenderHasDivineshild = defender.divineshild;//攻击前,被攻击随从是否具有圣盾
在
if (defender.isHero)//target is enemy hero { doDmgTriggers(); return; }
下添加
#region 随从或武器攻击后触发超杀效果 if (oldHp < attackerAngr && !defenderHasDivineshild) { if (!attacker.isHero) { attacker.handcard.card.sim_card.OnOverkill(this, attacker); } else { Weapon weapon = attacker.own ? this.ownWeapon : this.enemyWeapon; weapon.card.sim_card.OnOverkill(this, weapon); } } #endregion
解释一下定义defenderHasDivineshild的原因:超杀在攻击伤害结算之后进行结算,此时原有圣盾效果已经失效,所以必须在攻击前定义
6.一些SIM的实现
namespace HREngine.Bots { class Sim_TRL_010 : SimTemplate //* 中场拾荒者 Half-Time Scavenger { //<b>Stealth</b><b>Overkill</b>: Gain 3 Armor. //<b>潜行</b><b>超杀</b>:获得3点护甲值。 public override void OnOverkill(Playfield p, Minion m) { if (m.own) { p.ownHero.armor += 3; } else { p.enemyHero.armor += 3; } } } }
namespace HREngine.Bots { class Sim_TRL_012 : SimTemplate //* 图腾重击 Totemic Smash { //Deal $2 damage. <b>Overkill</b>: Summon a basic Totem. //造成$2点伤害。<b>超杀</b>:召唤一个基础图腾。 CardDB.Card kid = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.CS2_050); public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice) { int dmg = ownplay ? p.getSpellDamageDamage(2) : p.getEnemySpellDamageDamage(2); int pos = ownplay ? p.ownMinions.Count : p.enemyMinions.Count; if (target != null) { if (!target.divineshild && target.Hp < dmg) { p.minionGetDamageOrHeal(target, dmg); p.callKid(kid, pos, ownplay); } else { p.minionGetDamageOrHeal(target, dmg); } } } } }