关于持续伤害效果的制作与小羽大佬帖子的一点扩充
本帖最后由 mrf 于 2021-7-10 22:07 编辑#以下所有内容均在决定版测试,原版不保证有效(应该是指定不行),语句未经过充分测试,不保证正确性,仅供参考和交流,本人修改萌新一枚
我之前希望做一个单位持续伤害的效果,然后由于眼瞎,没有看到印加的毒箭效果,于是有了这番对话:
emmmm……
先上小羽大佬的链接:https://www.aoebbs.net/thread-696-1-1.html
但是其实我并没有参考这个帖子(一点都没有,因为这种不写语句作用的说明对我来说跟没有是一样的{:7_265:})
下面就来说说我的思考过程和实现方式。前面的都没什么用,想要看实现方式直接从红色分割线看起就彳亍,想直接看毒箭效果从绿色分割线看起,或者点上面目录。
首先,根据大佬们的提示,我要找到印加的毒箭单位。我没有用过印加,开游戏再找太慢,所以我直接在stringtabley.xml中搜索关键字“毒箭”,最后定位到一个stringid:80035
<string _locid="80035">配有毒箭的步弓手能够造成持续性的中毒伤害。很适合对付重装步兵和轻型远程骑兵。</string><!--如果没有修改过应该是31878行左右-->接着,在protoy.xml中搜索80035,找到一个叫deJungleBowman的单位
<unit id="1504" name="deJungleBowman">
<dbid>2152</dbid>
<displaynameid>80032</displaynameid>
<editornameid>80033</editornameid>
<populationcount>1</populationcount>
<obstructionradiusx>0.4900</obstructionradiusx>
<obstructionradiusz>0.4900</obstructionradiusz>
<formationcategory>Ranged</formationcategory>
<maxvelocity>4.5000</maxvelocity>
<maxrunvelocity>6.5000</maxrunvelocity>
<movementtype>land</movementtype>
<turnrate>18.0000</turnrate>
<animfile>units\natives\inca\bowman\bowman.xml</animfile>
<impacttype>Flesh</impacttype>
<physicsinfo>dude</physicsinfo>
<icon>resources\art\units\natives\inca\bowman_icon.png</icon>
<portraiticon>resources\art\units\natives\inca\bowman_portrait.png</portraiticon>
<rollovertextid>80035</rollovertextid>
<shortrollovertextid>80034</shortrollovertextid>发现它的tactics是junglebowman.tactics,接着就打开它。以下是它的内容:
<tactics>
上面那个action,其中多数语句和普通弓箭手的远程攻击语句是一样的,圣典里都有写,那些作用未明的语句我肯定研究不明白,所以直接看加粗的两句。
<projectile>ArrowPoisoned</projectile>这句是定义发射物的,然而我们看发射物本身并没有什么蹊跷,跟普通的箭矢Arrow几乎是一样的,所以问题肯定在第二个句子(废话)。
——————分割线——————
<attachprotounit>PoisonAttachment</attachprotounit>这里定义了一个attachprotounit,我猜测可能是用来使被攻击者绑定一个单位的语句。
在protoy找到PoisonAttachment,发现代码如下:
<unit id="1514" name="PoisonAttachment">
<dbid>2162</dbid>
<displaynameid>79922</displaynameid>
<obstructionradiusx>0.1000</obstructionradiusx>
<obstructionradiusz>0.1000</obstructionradiusz>
<maxvelocity>60.0000</maxvelocity>
<movementtype>air</movementtype>
<animfile>effects\projectiles\poison.xml</animfile>
<lifespan>4.0000</lifespan>
<los>1.0000</los>
<unitaitype>HandCombative</unitaitype>
<unittype>Projectile</unittype>
<unittype>EmbellishmentClass</unittype>
<flag>InvulnerableIfGaia</flag>
<flag>Invulnerable</flag>
<flag>NoIdleActions</flag>
<flag>DoNotDieAtZeroHitpoints</flag>
<flag>NoHPBar</flag>
<flag>NonAutoFormedUnit</flag>
<flag>DoNotShowOnMiniMap</flag>
<flag>NotSelectable</flag>
<flag>NotSearchable</flag>
<flag>NoTieToGround</flag>
<flag>DoNotCreateUnitGroupAutomatically</flag>
<flag>NoBloodOnDeath</flag>
<flag>Projectile</flag>
<flag>NonCollideable</flag>
<flag>DestroyProjectile</flag>
<flag>DontRotateObstruction</flag>
<flag>NotPlayerPlaceable</flag>
<flag>Tracked</flag>
<tactics>poison.tactics</tactics>
<protoaction>
<name>HandAttack</name>
<damage>1.000000</damage>
<damagetype>Siege</damagetype>
<rof>1.000000</rof>
</protoaction>
<protoaction>
<name>Attaching</name>
<damage>1.000000</damage>
<damagetype>Siege</damagetype>
<rof>1.000000</rof>
</protoaction>
</unit>可以看到它调用了一个叫poison.tactics的战术,并且有两个单位动作。再打开这个战术文件:
<tactics>
<action>
<name stringid="38134">Attaching</name>
<type>Attaching</type>
<maxrange>10.75</maxrange>
<rate type="Unit">1.0 </rate>
<attackaction>1</attackaction>
<handlogic>1</handlogic>
<speedboost>1</speedboost>
<anim>HandAttack</anim>
<idleanim>CombatIdle</idleanim>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="38134">HandAttack</name>
<type>Attack</type>
<maxrange>1.75</maxrange>
<rate type="Unit">1.0 </rate>
<attackaction>1</attackaction>
<handlogic>1</handlogic>
<speedboost>1</speedboost>
<anim>HandAttack</anim>
<idleanim>CombatIdle</idleanim>
</action>
<tactic>Melee<action priority="100">HandAttack</action><attacktype>LogicalTypeHandUnitsAttack</attacktype><autoattacktype>LogicalTypeHandUnitsAutoAttack</autoattacktype><attackresponsetype>LogicalTypeHandUnitsAttack</attackresponsetype><runaway>0</runaway><autoretarget>1</autoretarget></tactic>
</tactics>到这里我才达到小羽大佬帖子指出的位置,之前的部分可谓废话连篇,所以请往下看(23333)。
——————分割线——————(为啥不用自带分割线?我乐意~)
protoy涉及两个单位动作,这两个动作在tactics里都有定义。因为它是个发射物而且带有一堆一看就知道属于那种不可操作也不可见的东西,所以不用管它的art文件,直接看战术。
第一个战术,Attaching,是一个之前(圣典里)没有的新战术。
据测试:<maxrange>语句似乎没什么作用,改成100,1或0都不影响效果。
<rate>语句似乎也没什么作用,改成0不影响效果。
<attackaction>攻击语句都有,没有就会失效。
后面几个用途跟圣典里的就一样了。
第二个战术,Attack,就是一个普通的攻击动作。
然后看protoy。
HandAttack,就是一个攻击效果,对敌人进行Siege(炮轰)攻击。联系到上面一个LifeSpan,我们知道它的作用机制大致是:以rof为1持续伤害目标,直到4秒后死亡,那么效果就是对方“中毒”了,每秒钟受到1点伤害。
需要注意的是,因为这里的伤害类型为Siege,所以那些具有护甲的单位可能会对这个伤害有一定免疫(但是似乎1点伤害是下限,怎么免疫都会受到)。
而那个Attaching伤害,经过测试似乎并不起作用,改成多少都不影响伤害,起到伤害作用的只有HandAttack动作。
知道这些,我们要想复刻一个类似的效果就有了理论依据,接下来就是实(瞎)践(试)。
我希望给长弓兵添加一个带有持续伤害的攻击,并需要科技来启用,名字就叫锈蚀箭头(古代不是有把箭插土里或者用锈的箭头以期达到感染对方的目的嘛,所谓破伤风箭)。
首先,找到protoy的长弓部分,并在下面添加一个攻击:
<protoaction>
<name>RustAttack</name>
<damage>8.500000</damage>
<damagetype>Ranged</damagetype>
<minrange>2.000000</minrange>
<maxrange>22.000000</maxrange>
<rof>1.500000</rof>
<damagebonus type="AbstractLightCavalry">2.000000</damagebonus>
<damagebonus type="xpEagleKnight">2.000000</damagebonus>
<damagebonus type="AbstractHeavyInfantry">1.250000</damagebonus>
<damagebonus type="AbstractCoyoteMan">0.750000</damagebonus>
<damagebonus type="AbstractCavalry">0.750000</damagebonus>
</protoaction>因为有持续伤害,所以我调小了初始伤害,解释起来也很简单:锈住的箭头钝了嘛!(伤害只向下舍入整数所以其实只有8但是我懒得改而且我有强迫症~)
同样加上各种加成减成。
再找到长弓的战术文件,添加一个action:
<action>
<name stringid="38127">RustAttack</name>
<type>Attack</type>
<attackaction>1</attackaction>
<rangedlogic>1</rangedlogic>
<anim>Volley_standing_attack</anim>
<reloadanim>Volley_standing_reload</reloadanim>
<idleanim>Volley_standing_idle</idleanim>
<accuracy>1.0</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<aimbonus>0</aimbonus>
<maxspread>5</maxspread>
<spreadfactor>0.25</spreadfactor>
<trackrating>12</trackrating>
<unintentionaldamagemultiplier>0.7</unintentionaldamagemultiplier>
<projectile>ArrowPoisoned</projectile>
<minrange>2</minrange>
<rate type="Unit">1.0</rate>
<attachprotounit>RustAttachment</attachprotounit>
<perfectaccuracy>1</perfectaccuracy>
</action>其他的语句都不重要,最重要的是<attachprotounit>RustAttachment</attachprotounit>
这是个新加的单位,在protoy里复制PoisonAttachment就行,然后简单修改一下:
<unit id="1514" name="RustAttachment">
<dbid>2162</dbid>
<displaynameid>79922</displaynameid>
<obstructionradiusx>0.1000</obstructionradiusx>
<obstructionradiusz>0.1000</obstructionradiusz>
<maxvelocity>60.0000</maxvelocity>
<movementtype>air</movementtype>
<animfile>effects\projectiles\poison.xml</animfile>
<lifespan>5.0000</lifespan>
<los>1.0000</los>
<unitaitype>HandCombative</unitaitype>
<unittype>Projectile</unittype>
<unittype>EmbellishmentClass</unittype>
<flag>InvulnerableIfGaia</flag>
<flag>Invulnerable</flag>
<flag>NoIdleActions</flag>
<flag>DoNotDieAtZeroHitpoints</flag>
<flag>NoHPBar</flag>
<flag>NonAutoFormedUnit</flag>
<flag>DoNotShowOnMiniMap</flag>
<flag>NotSelectable</flag>
<flag>NotSearchable</flag>
<flag>NoTieToGround</flag>
<flag>DoNotCreateUnitGroupAutomatically</flag>
<flag>NoBloodOnDeath</flag>
<flag>Projectile</flag>
<flag>NonCollideable</flag>
<flag>DestroyProjectile</flag>
<flag>DontRotateObstruction</flag>
<flag>NotPlayerPlaceable</flag>
<flag>Tracked</flag>
<tactics>rust.tactics</tactics>
<protoaction>
<name>HandAttack</name>
<damage>2.500000</damage>
<damagetype>Siege</damagetype>
<damagebonus type="AbstractLightCavalry">2.000000</damagebonus>
<damagebonus type="xpEagleKnight">2.000000</damagebonus>
<damagebonus type="AbstractHeavyInfantry">1.250000</damagebonus>
<damagebonus type="AbstractCoyoteMan">0.750000</damagebonus>
<damagebonus type="AbstractCavalry">0.750000</damagebonus>
<rof>1.000000</rof>
</protoaction>
<protoaction>
<name>Attaching</name>
<damage>2.500000</damage>
<damagetype>Siege</damagetype>
<damagebonus type="AbstractLightCavalry">2.000000</damagebonus>
<damagebonus type="xpEagleKnight">2.000000</damagebonus>
<damagebonus type="AbstractHeavyInfantry">1.250000</damagebonus>
<damagebonus type="AbstractCoyoteMan">0.750000</damagebonus>
<damagebonus type="AbstractCavalry">0.750000</damagebonus>
<rof>1.000000</rof>
</protoaction>
</unit>我启用了rust.tactics,但其实直接用poison.tactics就可以。
因为中毒伤害本质是一个Siege,所以同样可以添加各种加成数据。根据之前的测试,其实只改HandAttack就行。我把lifespan调成5,damage调成2.5,这样总共伤害是2.5(2)*5+8(初始)=18(?我算的对不还是先计算结果后向下舍入,总之至少是18点伤害,要么是20点)。
接下来,我希望长弓可以在普通箭头和生锈的箭头之间切换,那么就得需要添加一个战术。
在battle.xml中添加:
<squadmode>
<name>Rust</name>
<tactic>Rust</tactic>
<unittype>AbstractRangedInfantry</unittype>
<targetunittype>All</targetunittype>
<stance>Defensive</stance>
<formationtype>Line</formationtype>
<formationlinelinespacing>0.8</formationlinelinespacing>
<formationlinecolumnspacing>0.8</formationlinecolumnspacing>
<randomspacingoffset>0.35</randomspacingoffset>
<cooldowntime>5000</cooldowntime>
<transitiontimein>500</transitiontimein>
<activeicon>resources\images\icons\command\tactics_volley_cur.png</activeicon>
<availableicon>resources\images\icons\command\tactics_volley_avl.png</availableicon>
<unavailableicon>resources\images\icons\command\tactics_volley_lock.png</unavailableicon>
<rolloverstringid>99960</rolloverstringid>
</squadmode>语句作用看圣典,图标可以自选,我偷懒了。
然后再切换到长弓的战术文件,在下面添加一个Rust战术:
<tactic>Rust<action priority="100">RustAttack</action><action priority="75">BuildingAttack</action><action priority="25">VolleyHandAttack</action><action>Build</action><active>0</active><attacktype>LogicalTypeRangedUnitsAttack</attacktype><autoattacktype>LogicalTypeRangedUnitsAutoAttack</autoattacktype><attackresponsetype>LogicalTypeRangedUnitsAttack</attackresponsetype><runaway>1</runaway><autoretarget>1</autoretarget><idleanim>Volley_standing_idle</idleanim><boredanim>Volley_standing_bored</boredanim><deathanim>Death_by_melee</deathanim><walkanim>Volley_walk</walkanim><joganim>Volley_jog</joganim><runanim>Volley_run</runanim></tactic>复制上面一个战术,把xxxRangedAttack换成RustAttack就行。再用<active>0</active>将其禁用,通过改良科技开启。
然后我们转到techtreey.xml,在这里改良科技让长弓兵开启战术。
<tech name="RustArrow" type="Normal">
<dbid>6343</dbid>
<displaynameid>99958</displaynameid>
<cost resourcetype="Wood">350.0000</cost>
<cost resourcetype="Gold">150.0000</cost>
<researchpoints>30.0000</researchpoints>
<status>UNOBTAINABLE</status>
<icon>resources\art\units\infantry_ranged\longbow\longbow_icon.png</icon>
<rollovertextid>99957</rollovertextid>
<prereqs>
<specificage>Age2</specificage>
<techstatus status="Active">Fortressize</techstatus>
</prereqs>
<effects>
<effect type="Data" tactic="Rust" amount="1.00" subtype="TacticEnable" relativity="Absolute">
<target type="ProtoUnit">Longbowman</target>
</effect>
</effects>
</tech>名字、图标和成本自己定,主要是通过TacticEnable启用战术。
然后在兵营的tech里添加这个科技(在哪添加随意),并在techtreey里启用:
<tech row="0" page="1" column="5">RustArrow</tech> <effect type="TechStatus" status="obtainable">RustArrow</effect>
之后,为了游戏正常一点(已经很不正常了好吗),在每次升级的时候,也要把锈箭伤害增加,不然到后期2.5的伤害就是刮痧……
找到长弓兵的升级科技(这里以老练升级为例),改成:
<tech name="VeteranLongbowmen" type="Normal">
<dbid>86</dbid>
<displaynameid>23188</displaynameid>
<cost resourcetype="Wood">200.0000</cost>
<cost resourcetype="Gold">200.0000</cost>
<researchpoints>30.0000</researchpoints>
<status>UNOBTAINABLE</status>
<icon>resources\images\icons\techs\veteran_archer_infantry\veteran_archer_infantry.png</icon>
<rollovertextid>23187</rollovertextid>
<flag>CountsTowardMilitaryScore</flag>
<flag>UpgradeTech</flag>
<prereqs>
<techstatus status="Active">Fortressize</techstatus>
</prereqs>
<effects>
<effect type="Data" amount="1.20" subtype="Hitpoints" relativity="BasePercent">
<target type="ProtoUnit">Longbowman</target>
</effect>
<effect type="SetName" proto="Longbowman" culture="none" newname="36183">
</effect>
<effect type="Data" amount="0.00" subtype="UpdateVisual" unittype="Longbowman" relativity="Absolute">
<target type="Player">
</target>
</effect>
<effect type="Data" amount="1.20" subtype="Damage" allactions="1" relativity="BasePercent">
<target type="ProtoUnit">Longbowman</target>
</effect>
<effect type="Data" amount="1.20" subtype="Damage" allactions="1" relativity="BasePercent">
<target type="ProtoUnit">RustAttachment</target>
</effect>
</effects>
</tech>这样,锈蚀伤害也增加了20%。其他升级同理。
经过上面的一番折腾,长弓兵已经拥有了攻击附带持续伤害的能力辣{:7_243:}
——————分割线——————
如果你愿意,可以让中毒效果携带范围伤害,做法很简单,在protoy里面加上<damagearea>,再在rust.tactics(poison.tactics)里把范围伤害<basedamagecap>1</basedamagecap>加上,这样就可以一毒一大片了。
P.S.我还加了个燃烧箭,射程短rof高,但是是炮轰伤害并且带有范围,但是这是另外一个话题了。与这个帖有交集的就是这个燃烧箭同样是新增了一个战术,在battle.xml里定义的。
我就是水贴小能手,几天水了四个帖233333
补充内容 (2021-7-11 00:31):
所有的缩进几乎都是我用空格一个一个打的……为的就是复制就能用,记住有些代码块开头就有两个空格,复制要带上。 吐槽一句:代码编辑器就不应该带加粗功能,不能加粗不说还多出个<b></b>。我已经尽量删掉夹杂在代码区的加粗命令了,如果看到<b></b>请忽略,不要复制到代码中去。造成的麻烦我表示非常抱歉! 虽然我没有DE但是我听说DE有attaching语句,就是把毒箭附在什么上面,所以我怀疑ArrowPoisoned有一个攻击的tactics 妙啊!
页:
[1]