法术迸发(Spellburst)
阅读原文时间:2023年07月08日阅读:1

法术迸发 (EN:Spellburst ) 是一种在《通灵学园》中加入的关键字异能,在玩家打出一张法术牌后触发,只能触发一次。

  • 若随从在法术结算过程中死亡,则不会触发效果

首先一定可以从场上随从的entity(实体)上读取GAME_TAG从而读取到是否可以进行法术迸发的状态。

在使用一张法术牌之后遍历一下随从,再检查一下武器的法术迸发状态,从而执行法术迸发操作。故想到添加一个 SimTemplate 可以做到统一写法。

主程序内部添加法术迸发的GAME_TAG

  • Triton.Game.Mapping.GAME_TAG 加入法术迸发的枚举 SPELLBURST = 1427

    这一步的要求是需要有无壳的主程序或有源码,没有无壳主程序可以不做第1步,继续向下做,遇到红色字体时选择对应的其他步骤

    (右键编辑类,加入枚举,然后编译。编译后记得保存。)

2021/1/13补充:贴吧发布的20210109折腾版已经更新当时的最新 GAME_TAG,所以第一步不需要做了

在 CardDB.cs 中添加 Spellburst 属性

  1. 声明属性

    private bool spellburst = false;
    
    public bool Spellburst
    {
        get
        {
            return spellburst;
        }
        set
        {
            spellburst = value;
        }
    }
  2. 添加解析 CardDefs.xml 文件时对 Spellburst 的读取

    case 1427: c.Spellburst = value == 1; break;//法术迸发

在 Minion.cs 中添加 Spellburst 属性

  1. 声明属性,与 CardDB.cs 中相同

  2. 在构造器中添加 Spellburst

    this.Spellburst = m.Spellburst;

  3. setMinionToMinion 方法中添加 Spellburst

    this.Spellburst = m.Spellburst;

在 Weapon.cs 中添加 Spellburst 属性

  1. 声明属性,与 CardDB.cs 中相同

  2. 在构造器中、isEqual 方法中、equip 方法中添加 Spellburst

    仿照其他格式与 Minion.cs 中的添加方式添加即可

在 silverfish_HB.cs 中添加随从和武器法术迸发状态的读取

在这一步中,遇到 GAME_TAG.SPELLBURST 要替换成 (GAME_TAG)1427

//在相应位置添加
ownWeapon.Spellburst = (weapon.GetTag(GAME_TAG.SPELLBURST) == 1) ? true : false;

enemyWeapon.Spellburst = (weapon.GetTag(GAME_TAG.SPELLBURST) == 1) ? true : false;

m.Spellburst = (entitiy.GetTag(GAME_TAG.SPELLBURST) == 0) ? false : true;
//若Spellburst为true,则打出法术后能触发其法术迸发效果

在 SimTemplate.cs 中添加虚函数

/// <summary>
/// 法术迸发(随从)
/// </summary>
/// <param name="p">场面</param>
/// <param name="m">法术迸发的随从</param>
/// <param name="hc">触发法术迸发的手牌</param>
public virtual void onSpellburst(Playfield p, Minion m, Handmanager.Handcard hc)
{
    return;
}

/// <summary>
/// 法术迸发(武器)
/// </summary>
/// <param name="p">场面</param>
/// <param name="w">法术迸发的武器</param>
/// <param name="hc">触发法术迸发的手牌</param>
public virtual void onSpellburst(Playfield p, Weapon w, Handmanager.Handcard hc)
{
    return;
}

在 Playfield.cs 中添加法术迸发的触发

搜索 onCardplay ,有3处结果,其中有一处是我方打出法术/武器牌的位置,在这之后添加法术迸发的触发

//法术迸发
foreach (Minion m in this.ownMinions.ToArray())
{
    if (m.Spellburst == true && !m.silenced)
    {
        m.handcard.card.sim_card.onSpellburst(this, m, hc);
        m.Spellburst = false;
        }
}
if (this.ownWeapon.Spellburst == true)
{
    this.ownWeapon.card.sim_card.onSpellburst(this, this.ownWeapon, hc);
    this.ownWeapon.Spellburst = false;
}

其余内容

  • 沉默使随从的 Spellburst 属性发生改变

    Minion.csbecomeSilence 方法中添加 Spellburst = false;

  • 2021年2月11日补充:在 Playfield.csisEqual 方法中对应处添加

至此添加完毕。

using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
    class Sim_SCH_231 : SimTemplate //* 新生刺头 Intrepid Initiate
    {
        //<b>Spellburst:</b> Gain +2_Attack.
        //<b>法术迸发:</b>获得+2攻击力。
        public override void onSpellburst(Playfield p, Minion m,Handmanager.Handcard hc)
        {
            p.minionGetBuffed(m, 2, 0);
        }
    }
}



using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
    class Sim_SCH_182 : SimTemplate //* 演讲者吉德拉 Speaker Gidra
    {
        //[x]<b><b>Rush</b>, Windfury</b><b><b>Spellburst</b>:</b> GainAttackand Health equal tothe spell's Cost.
        //<b>突袭,风怒</b><b>法术迸发:</b>获得等同于法术法力值消耗的攻击力和生命值。
        public override void onSpellburst(Playfield p, Minion m,Handmanager.Handcard hc)
        {
            p.minionGetBuffed(m, hc.manacost, hc.manacost);
        }
    }
}



using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
    class Sim_SCH_248 : SimTemplate //* 甩笔侏儒 Pen Flinger
    {
        //<b>Battlecry:</b> Deal 1 damage. <b>Spellburst:</b> Return thisto_your hand.
        //<b>战吼:</b>造成1点伤害。<b>法术迸发:</b>将该随从移回你的手牌。
        public override void getBattlecryEffect(Playfield p, Minion own, Minion
target, int choice)
        {
            if (target != null) p.minionGetDamageOrHeal(target, 1);
        }
        public override void onSpellburst(Playfield p, Minion m,Handmanager.Handcard hc)
        {
            p.minionReturnToHand(m, m.own, 0);
        }
    }
}



using System;
using System.Collections.Generic;
using System.Text;
namespace HREngine.Bots
{
    class Sim_SCH_523 : SimTemplate //* 仪式重槌 Ceremonial Maul
    {
        //<b>Spellburst</b>: Summon a Student with <b>Taunt</b> and stats equalto the spell's Cost.
        //<b>法术迸发:</b>召唤一个属性值等同于法术法力值消耗的并具有<b>嘲讽</b>的学生。
        CardDB.Card weapon = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.SCH_523);
        CardDB.Card kid = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.SCH_523t);
        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            p.equipWeapon(weapon, ownplay);
        }
        public override void onSpellburst(Playfield p, Weapon w,Handmanager.Handcard hc)
        {
            int place = p.ownMinions.Count;
            if (place < 7)
            {
                p.callKid(kid, place, true);
                p.minionSetAngrToX(p.ownMinions[place-1], hc.manacost);//有的silverfish里是minionSetAttackToX
                p.minionSetLifetoX(p.ownMinions[place-1], hc.manacost);
            }
        }
    }
}

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章