灵魂残片相关的添加

首先需要上一篇的牌库修复后才能识别牌库中的衍生卡——灵魂残片,本文才会起作用。

Playfield.cs 的添加

添加灵魂残片字段,并在两处构造器中对应添加。

//HREngine.Bots.Playfield
/// <summary>
/// 灵魂残片的数量
/// </summary>
public int AnzSoulFragments = 0;

//HREngine.Bots.Playfield.Playfield()
AnzSoulFragments = prozis.turnDeck.ContainsKey(CardDB.cardIDEnum.SCH_307t) ? prozis.turnDeck[CardDB.cardIDEnum.SCH_307t] : 0;

//HREngine.Bots.Playfield.Playfield(Playfield p)
this.AnzSoulFragments = p.AnzSoulFragments;

SIM 的添加

灵魂残片

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_307t : SimTemplate //* 灵魂残片 Soul Fragment
	{
        //<b>Casts When Drawn</b>Restore #2 Health to your hero.
        //<b>抽到时施放</b>为你的英雄恢复#2点生命值。
        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            int heal = (ownplay) ? p.getSpellHeal(2) : p.getEnemySpellHeal(2);
            Minion m = ownplay ? p.ownHero : p.enemyHero;
            p.minionGetDamageOrHeal(m, -heal);
        }
    }
}

注:这个 sim 写的是灵魂残片从手牌中打出的一种特殊情况,而不是触发的抽到时释放的效果。

洗入灵魂残片

精魂狱卒

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_700 : SimTemplate //* 精魂狱卒 Spirit Jailer
	{
        //<b>Battlecry:</b> Shuffle 2 Soul Fragments into your deck.
        //<b>战吼:</b>将两张灵魂残片洗入你的牌库。
        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            if (own.own)
            {
                p.AnzSoulFragments += 2;
                p.ownDeckSize += 2;
            }
            else
            {
                p.enemyDeckSize += 2;
            }
        }
    }
}

灵魂剥离

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_701 : SimTemplate //* 灵魂剥离 Soul Shear
	{
        //[x]Deal $3 damage to aminion. Shuffle 2 SoulFragments into your deck.
        //对一个随从造成$3点伤害。将两张灵魂残片洗入你的牌库。
        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            if (target != null)
                if (ownplay)
                {
                    int dmg = p.getSpellDamageDamage(3);
                    p.minionGetDamageOrHeal(target, dmg);
                    p.AnzSoulFragments += 2;
                    p.ownDeckSize += 2;
                }
                else
                {
                    int dmg = p.getEnemySpellDamageDamage(3);
                    p.minionGetDamageOrHeal(target, dmg);
                    p.enemyDeckSize += 2;
                }
        }
    }
}

注:记得添加 PlayRequirement

校园精魂

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_307 : SimTemplate //* 校园精魂 School Spirits
	{
        //[x]Deal $2 damage to allminions. Shuffle 2 SoulFragments into your deck.
        //对所有随从造成$2点伤害。将两张灵魂残片洗入你的牌库。
        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            if (ownplay)
            {
                int dmg = p.getSpellDamageDamage(2);
                p.allMinionsGetDamage(dmg);
                p.AnzSoulFragments += 2;
                p.ownDeckSize += 2;
            }
            else
            {
                int dmg = p.getEnemySpellDamageDamage(2);
                p.allMinionsGetDamage(dmg);
                p.enemyDeckSize += 2;
            }
        }
    }
}

切髓之刃

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_252 : SimTemplate //* 切髓之刃 Marrowslicer
	{
        //<b>Battlecry:</b> Shuffle 2 Soul Fragments into your deck.
        //<b>战吼:</b>将两张灵魂残片洗入你的牌库。
        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            if (ownplay)
            {
                p.AnzSoulFragments += 2;
                p.ownDeckSize += 2;
            }
            else
            {
                p.enemyDeckSize += 2;
            }
        }
    }
}

摧毁灵魂碎片

影光学者

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_517 : SimTemplate //* 影光学者 Shadowlight Scholar
	{
        //<b>Battlecry:</b> Destroy a Soul Fragment in your deck to deal 3 damage.
        //<b>战吼:</b>摧毁一张你牌库中的灵魂残片,造成3点伤害。
        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            if (own.own)
            {
                if (p.AnzSoulFragments > 0 && target != null)
                {
                    p.AnzSoulFragments--;
                    p.ownDeckSize--;
                    p.minionGetDamageOrHeal(target, 3);
                }
            }
            else
            {
                if(target != null)
                {
                    p.enemyDeckSize--;
                    p.minionGetDamageOrHeal(target, 3);
                }
            }
        }
    }
}

残片震爆秘术师

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_355 : SimTemplate //* 残片震爆秘术师 Shardshatter Mystic
	{
        //<b>Battlecry:</b> Destroy a Soul Fragment in your deck to deal 3 damage to all other minions.
        //<b>战吼:</b>摧毁一张你牌库中的灵魂残片,对所有其他随从造成3点伤害。
        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            if (own.own)
            {
                if (p.AnzSoulFragments > 0)
                {
                    p.AnzSoulFragments--;
                    p.ownDeckSize--;
                    p.allMinionsGetDamage(3, own.entitiyID);
                }
            }
            else
            {
                p.enemyDeckSize--;
                p.allMinionsGetDamage(3, own.entitiyID);
            }
        }
    }
}

铸魂宝石匠

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_704 : SimTemplate //* 铸魂宝石匠 Soulshard Lapidary
	{
        //[x]<b>Battlecry:</b> Destroy a SoulFragment in your deck togive your hero +5 Attackthis turn.
        //<b>战吼:</b>摧毁一张你牌库中的灵魂残片,在本回合中使你的英雄获得+5攻击力。
        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            if (own.own)
            {
                if (p.AnzSoulFragments > 0)
                {
                    p.AnzSoulFragments--;
                    p.ownDeckSize--;
                    p.minionGetTempBuff(p.ownHero, 5, 0);
                }
            }
            else
            {
                p.enemyDeckSize--;
                p.minionGetTempBuff(p.enemyHero, 5, 0);
            }
        }
    }
}

虚空吸食者

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
    class Sim_SCH_343 : SimTemplate //* 虚空吸食者 Void Drinker
    {
        //[x]<b>Taunt</b>. <b>Battlecry:</b> Destroya Soul Fragment in yourdeck to gain +3/+3.
        //<b>嘲讽,战吼:</b>摧毁一张你牌库中的灵魂残片,获得+3/+3。
        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            if (own.own)
            {
                if (p.AnzSoulFragments > 0)
                {
                    p.AnzSoulFragments--;
                    p.ownDeckSize--;
                    p.minionGetBuffed(own, 3, 3);
                }
            }
            else
            {
                p.enemyDeckSize--;
                p.minionGetBuffed(own, 3, 3);
            }
        }
    }
}

读取灵魂残片

灵魂学家玛丽希亚

using System;
using System.Collections.Generic;
using System.Text;

namespace HREngine.Bots
{
	class Sim_SCH_703 : SimTemplate //* 灵魂学家玛丽希亚 Soulciologist Malicia
	{
        //<b>Battlecry:</b> For each Soul Fragment in your deck, summon a 3/3 Soul with <b>Rush</b>.@ <i>(@)</i>
        //<b>战吼:</b>你的牌库中每有一张灵魂残片,召唤一个3/3并具有<b>突袭</b>的灵魂。@<i>(@)</i>
        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            CardDB.Card kid = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.SCH_703t);
            if (own.own)
            {
                for (int i = 0; i < p.AnzSoulFragments; i++)
                {
                    int pos = (i % 2 == 0) ? own.zonepos : own.zonepos - 1;
                    if (p.ownMinions.Count < 7)
                        p.callKid(kid, pos, true);
                    else return;
                }
            }
        }
    }
}

原文地址:https://www.cnblogs.com/varc/p/14299267.html