[神代码用于普通角色] 复活队友、生命分担 写法概述

原贴来自贴吧,作者:eagrose


我对于神代码的研究不多,仅仅停留在中低层次的神代码上。
许多神角色很有爱,也体现了mugen代码的一些奇妙之处,因此我不热衷但也不反对神角色。
在学习中低层次神代码的过程中,我突发奇想,如果能够将部分副作用较小的神代码运用到普通对战中,
由于神代码的特殊性,或许能够创造一些在以前看来古怪甚至不可能完成的技能。
于是经过略曲折的一遍遍反复修改,两个古怪的组队模式专用技能就诞生了...
我始终认为,任何代码写出来就应该被分享和推广,于是我继续端自己的老底出来了...

首先说明一下,这种写法由于使用了少许神代码,相比普通角色代码稍显繁琐。
仅概述,若有不理解之处,请查阅以下神代码写法:
无视当身的hitdef、永续target、superpause冻结、NOKO断言、生命操作。

其次,神代码变换思路运用到普通对战中时,最大的困难在于避免神代码的副作用干扰。

最后,虽然基于神代码,但是它们已经被改造以用于普通角色,
这些技能面对真正的神级角色时,如其他普通代码一样,很可能失效。
搭载这些技能也远远不能构成神级攻击/防御面,或者说对于人物本身的性能级别几乎无变化。

ps.以下概述中的代码写法仅供参考,实际运用时请抓住思路,视情况具体修改。


————————————————————————————————————
大蛇的不洁生命
(本质:队友濒死时,复活队友一次)
 
—————————————————
思路:
通过使用hitdef控制器中罕见的参数affectteam=F,来允许攻击到队友。
(许多杀害队友的古怪技能即基于该参数)
 
为避免hitdef被敌方当身捕获后出现各种BUG,使用神代码【无视当身的HITDEF】。
 
通过使用p2state来进一步对队友进行操作。
 
通过使用神代码【永续target】在保持随时可以调用队友进行修改的同时,不干扰队友的正常动作。
 
通过变量记录琐碎细节,比如是否已经复活过一次,于是不再重复复活。
 
通过使用神代码【NOKO断言】来防止队友意外死亡。
(注意:NOKO断言只能作用于发起者本身挨打、目标受到发起者挨打两方面。
因此发起者自杀、目标受到非发起者挨打,依旧会死亡。故NOKO断言作用于队友尚不够确保其存活)
 
通过使用superpause冻结,来阻止队友在life=0时意外死亡。
 
—————————————————
主要代码概述:
 
攻击队友:
[State 0, Hitdef]
type = Hitdef
trigger1 = 1 《----神代码【无视当身的HITDEF】
affectteam = F
attr = ,AA 《----神代码【无视当身的HITDEF】
priority = 9999999, hit ;;Hit,Miss,Dodge 3 4 7 99999 9999999
hitflag = HLMAFD
guardflag = N
numhits = 0
sparkno = -1
hitsound = -1
p1stateno = 4215
p2stateno = 4216 《----对队友进行p2state操作
guard.dist = 0
hitonce = 1
ignorehitpause = 1
 
捕获后:
 
捕获目标超过一个,纠错(队友仅可能一人,说明抓错了helper等)
[State 0, TargetDrop];Drop other helper target (for example shadow clone)
type = TargetDrop
trigger1 = Numtarget > 1
trigger2 = target,ishelper
keepone = 1 《---只保留一个目标,扔掉其他
ignorehitpause = 1
 
捕获目标并非队友,扔掉目标
[State 0, TargetDrop]
type = TargetDrop
trigger1 = IsHelper(4211)
trigger1 = !(target,ID = partner,ID)
keepone = 0
ignorehitpause = 1
 
捕获目标并非队友,折回重新捕获
[State 0, ChangeState]
type = ChangeState
triggerall = !win || !lose || !drawgame
trigger1 = IsHelper(4211)
trigger1 = !(target,ID = partner,ID)
value = 4210
ignorehitpause = 1
 
 
实施神代码【永续target】
[State 0, ReversalDef]
type = ReversalDef
trigger1 = 1
reversal.attr = SCA
priority = 9999999, hit ;;Hit,Miss,Dodge 3 4 7 99999 9999999
hitflag = P
numhits = 0
sparkno = -1
hitsound = -1
guard.dist = 0
ignorehitpause = 1
supermovetime = 99999
pausemovetime = 99999
 
变量记录较为繁琐,略去。
 
贴图、特效等代码略去。
 
常时、有条件的NOKO断言(var(29)用于判断是否应该断言,后述)
[State 0, AssertSpecial]; ---- DO NOT CHANGE THIS!!!
type = AssertSpecial
triggerall = !((win || lose || drawgame) && roundstate = 2)
trigger1 = parent,var(29) = 1
flag = noko
ignorehitpause = 1
 
队友生命为0时,强制其改变状态进入己方p2state


————————————————————————————————————
伊格尼斯的仿生链接
(本质:生民共享,生命均分)
 
—————————————————
思路:
通过使用hitdef控制器中罕见的参数affectteam=F,来允许攻击到队友。
(许多杀害队友的古怪技能即基于该参数)
 
为避免hitdef被敌方当身捕获后出现各种BUG,使用神代码【无视当身的HITDEF】。
 
通过使用p2state来进一步对队友进行操作。
 
通过使用神代码【永续target】在保持随时可以调用队友进行修改的同时,不干扰队友的正常动作。
 
通过变量记录琐碎细节。
 
通过使用神代码【NOKO断言】来防止队友意外死亡。
(注意:NOKO断言只能作用于发起者本身挨打、目标受到发起者挨打两方面。
因此发起者自杀、目标受到非发起者挨打,依旧会死亡。故NOKO断言作用于队友尚不够确保其存活)
 
通过使用superpause冻结,来阻止队友在life=0时意外死亡。
 
通过使用生命操作,在单帧内运算调整自身和队友血量。
 
这里必须指出,永续target用于对队友进行生命操作(targetlifeadd),
而本体的生命操作则必须在本体上实施(lifeadd)。因为mugen没有parentlifeadd之类的控制器。
由于两者的生命操作被分开,处于不同的个体内,造成【必须】关注执行顺序。
(比如若本体代码被暂停,而永续target的helper尚在执行,则可能造成后者连续执行,代码错位)
这种类似“双线程之间互斥”的代码顺序要求,螺丝通过使用本体的一个变量作为顺序标记,
确保两段代码顺序严格保持一个接另一个。
 
—————————————————
主要代码概述:
 
攻击队友:
[State 0, Hitdef]
type = Hitdef
trigger1 = 1 《----神代码【无视当身的HITDEF】
affectteam = F
attr = ,AA 《----神代码【无视当身的HITDEF】
priority = 9999999, hit ;;Hit,Miss,Dodge 3 4 7 99999 9999999
hitflag = HLMAFD
guardflag = N
numhits = 0
sparkno = -1
hitsound = -1
p1stateno = 4215
p2stateno = 4216 《----对队友进行p2state操作
guard.dist = 0
hitonce = 1
ignorehitpause = 1
 
捕获后:
 
捕获目标超过一个,纠错(队友仅可能一人,说明抓错了helper等)
[State 0, TargetDrop];Drop other helper target (for example shadow clone)
type = TargetDrop
trigger1 = Numtarget > 1
trigger2 = target,ishelper
keepone = 1 《---只保留一个目标,扔掉其他
ignorehitpause = 1
 
捕获目标并非队友,扔掉目标
[State 0, TargetDrop]
type = TargetDrop
trigger1 = IsHelper(4211)
trigger1 = !(target,ID = partner,ID)
keepone = 0
ignorehitpause = 1
 
捕获目标并非队友,折回重新捕获
[State 0, ChangeState]
type = ChangeState
triggerall = !win || !lose || !drawgame
trigger1 = IsHelper(4211)
trigger1 = !(target,ID = partner,ID)
value = 4210
ignorehitpause = 1
 
 
实施神代码【永续target】
[State 0, ReversalDef]
type = ReversalDef
trigger1 = 1
reversal.attr = SCA
priority = 9999999, hit ;;Hit,Miss,Dodge 3 4 7 99999 9999999
hitflag = P
numhits = 0
sparkno = -1
hitsound = -1
guard.dist = 0
ignorehitpause = 1

supermovetime = 99999
pausemovetime = 99999
 
变量记录较为繁琐,略去。
 
贴图、特效等代码略去。
 
常时、有条件的NOKO断言(var(29)用于判断是否应该断言,后述)
[State 0, AssertSpecial]; ---- DO NOT CHANGE THIS!!!
type = AssertSpecial
triggerall = !((win || lose || drawgame) && roundstate = 2)
trigger1 = parent,var(29) = 1
flag = noko
ignorehitpause = 1
 
生命操作:
 
计算本体损血
;------------------------------
;caculate igniz life
;------------------------------
;CAUTION: parent-life caculating must count in the "delay of root's lifeadd", otherwise may cause BUG
[State 0, VarSet];caculate igniz life-lost parent,var(17)
type = ParentVarSet
triggerall = root,var(29) = 0 ;SYN ready 《---【代码同步】
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
trigger1 = Parent,life < Parent,LifeMax ;count in the "delay of root's lifeadd"
var(17) = Parent,LifeMax-Parent,life ;count in the "delay of root's lifeadd"
ignorehitpause = 1
 
;CAUTION: parent-life caculating must count in the "delay of root's lifeadd", otherwise may cause BUH
[State 0, VarSet];caculate igniz no change
type = ParentVarSet
triggerall = root,var(29) = 0 ;SYN ready 《---【代码同步】
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
trigger1 = Parent,life >= Parent,LifeMax ;count in the "delay of root's lifeadd"
var(17) = 0
ignorehitpause = 1
 
计算队友损血
;------------------------------
;caculate partner life
;------------------------------
[State 0, VarSet];caculate partner life-lost parent,var(18) ;parent,var(18) is positive !!!
type = ParentVarSet
triggerall = root,var(29) = 0 ;SYN ready 《---【代码同步】
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
trigger1 = NumPartner
trigger1 = Partner,life < partner,LifeMax
var(18) = partner,LifeMax-partner,life
ignorehitpause = 1
 
[State 0, VarSet];caculate partner no change
type = ParentVarSet
triggerall = root,var(29) = 0 ;SYN ready 《---【代码同步】
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
trigger1 = NumPartner
trigger1 = Partner,life >= partner,LifeMax
var(18) = 0
ignorehitpause = 1
 
本体生命操作实施
(注意!本体的生命操作必须在本体实施,而不能在技能的永续target helper上实施,
因此只能用变量传递回本体,再进行实施)
;------------------------------
;igniz life-chain --- cannot perform here, so send parent-vars to ROOT
;------------------------------
[State 0, TargetLifeAdd];life chain - igniz (+/-) ---send to parent,var(23)
type = ParentVarSet
triggerall = root,var(29) = 0 ;SYN ready 《---【代码同步】
triggerall = parent,var(23) = 0 ;It is not helper's duty to reset this var !!!
triggerall = !((Parent,life=[0,1]) || (partner,life=[0,1])) ;Life-share end when either nearly dead (but link not broken until both nearly dead)


triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
trigger1 = !NumHelper(97864) ;shadow clone doesn't exists
var(23) = Parent,var(17)-floor((Parent,var(17)+Parent,var(18))/2)
ignorehitpause = 1
 
队友生命操作实施(使用TargetLifeAdd)
;------------------------------
;partner life-chain
;------------------------------
[State 0, TargetLifeAdd];life chain - partner (+/-)
type = TargetLifeAdd
triggerall = root,var(29) = 0 ;SYN ready 《---【代码同步】
triggerall = !((Parent,life=[0,1]) || (partner,life=[0,1])) ;Life-share end when either nearly dead (but link not broken until both nearly dead)
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
trigger1 = !NumHelper(97864)
value = parent,var(18)-floor((parent,var(17)+parent,var(18))/2)
kill = 0
absolute = 1
ignorehitpause = 1
 
【代码同步】队友生命操作结束,通知本体进行本体生命操作
;------------------------------
;Syn reset var 29
;------------------------------
[State 0, ParentVarSet];var(29) reset tell root to continue
type = ParentVarSet
triggerall = root,var(29) = 0 ;SYN ready
trigger1 = 1
var(29) = 1111
ignorehitpause = 1
 
自身不濒死,队友濒死时,防止队友被KO
;------------------------------
;partner is nearly dead, life-share end, but link not broken until self is also nearly dead.
;------------------------------
超级暂停防止KO
[State -2, SuperPause]
type = SuperPause
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
triggerall = partner,alive
triggerall = partner,life = 0 ;partner nearly dead, life-share end
trigger1 = parent,life > 1 ;self not nearly dead
trigger1 = parent,alive
time = 2
anim = -1
movetime = 2
darken = 1
p2defmul = 1
poweradd = 0
unhittable = 1
ignorehitpause = 1
 
NOKO断言防止KO
[State 0, AssertSpecial]
type = AssertSpecial
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
triggerall = partner,alive
triggerall = partner,life = 0 ;partner nearly dead, life-share end
trigger1 = parent,life > 1 ;self not nearly dead
trigger1 = parent,alive
flag = noko
ignorehitpause = 1
 
回血1点(life=0变为life=1)
[State 0, TargetLifeadd]
type = TargetLifeadd
triggerall = IsHelper(4211)
triggerall = var(10) = 1 ;IGNIZ's BIONIC LINK is on
triggerall = partner,alive
triggerall = partner,life = 0 ;partner nearly dead, life-share end
trigger1 = parent,life > 1 ;self not nearly dead
trigger1 = parent,alive
value = 1
kill = 0
absolute = 1
ignorehitpause = 1

—————————————————
-2下需要设置一些必要的辅助系统:
贴图技能条等代码略去。
 
本体生命操作处于本体-2下:
;------------------------------
;Igniz lifeadd actually perform
;------------------------------
[State -2, LifeAdd];life chain - igniz (+/-) (normal or nightmare both here)---received from helper(4211)
type = LifeAdd
Triggerall = var(29) = 1111 ;SYN ready 《---【代码同步】
Triggerall = var(39) = 1
triggerall = !((life=[0,1]) || (partner,life=[0,1])) ;Life-share end when either nearly dead (but link not broken until both nearly dead)
TRIGGERALL = !IsHelper ;not shadow clone
triggerall = NumPartner
triggerall = Numhelper(4211)
triggerall = Helper(4211),stateno = 4215
trigger1 = var(23) != 0
value = var(23)
kill = 0
absolute = 1
ignorehitpause = 1
 
【代码同步】本体生命操作结束,通知永续target helper进行队友生命操作
;------------------------------
;Syn reset var 29
;------------------------------
[State 0, VarSet];var(29) reset tell helper to continue
type = VarSet
Triggerall = var(29) = 1111 ;SYN ready
TRIGGERALL = !IsHelper ;not shadow clone
trigger1 = 1
var(29) = 0
ignorehitpause = 1
 
队友不濒死,自身濒死时,防止自身被KO
;------------------------------
;self is nearly dead, life-share end, but link not broken until partner is also nearly dead.
;------------------------------
超级暂停防止KO
[State -2, SuperPause]
type = SuperPause
Triggerall = var(39) = 1
TRIGGERALL = !IsHelper ;not shadow clone
triggerall = NumPartner
triggerall = Numhelper(4211)
triggerall = Helper(4211),stateno = 4215
triggerall = alive
triggerall = life = 0 ;self nearly dead, life-share end
trigger1 = partner,alive
trigger1 = partner,life > 1 ;partner not nearly dead
time = 2
anim = -1
movetime = 2
darken = 1
p2defmul = 1
poweradd = 0
unhittable = 1
ignorehitpause = 1
 
NOKO断言防止KO
[State -2, Assertspecial]
type = Assertspecial
Triggerall = var(39) = 1
TRIGGERALL = !IsHelper ;not shadow clone
triggerall = NumPartner
triggerall = Numhelper(4211)
triggerall = Helper(4211),stateno = 4215
triggerall = alive
triggerall = life = 0 ;self nearly dead, life-share end
trigger1 = partner,alive
trigger1 = partner,life > 1 ;partner not nearly dead
flag = noko
ignorehitpause = 1
 
回血1点(life=0变为life=1)
[State -2, Lifeadd]
type = Lifeadd
Triggerall = var(39) = 1
TRIGGERALL = !IsHelper ;not shadow clone
triggerall = NumPartner
triggerall = Numhelper(4211)
triggerall = Helper(4211),stateno = 4215
triggerall = alive
triggerall = life = 0 ;self nearly dead, life-share end
trigger1 = partner,alive
trigger1 = partner,life > 1 ;partner not nearly dead
value = 1
kill = 0
absolute = 1
ignorehitpause = 1
 
 
NOKO断言:
 
由于情况过于复杂,所以用变量统计
[State 0, VarSet];noko judge initiate var(21)
type = VarSet


TRIGGERALL = !IsHelper ;not shadow clone
trigger1 = 1
var(21) = 0
ignorehitpause = 1
 
何时应该启用NOKO:均非濒死时、有且仅有一方濒死时
[State 0, VarSet];noko enable
type = VarSet
TRIGGERALL = !IsHelper ;not shadow clone
triggerall = var(21) = 0
triggerall = NumPartner
triggerall = Numhelper(4211)
triggerall = Helper(4211),stateno = 4215
;Link broken when both nearly dead (end life-share)
trigger1 = (life!=[0,1]) || (partner,life!=[0,1])
;but not when "self life = 0 but should not ko" --- because self will regain to life=1 next tick, if partner not nearly dead
trigger2 = (Life=[0,1]) && alive && (partner,alive) && (partner,life>1)
;but not when "partner life = 0 but should not ko" --- because partner will regain to life=1 next tick, if self not nearly dead
trigger3 = (partner,life=[0,1]) && (partner,alive) && alive && life>1
var(21) = 1
ignorehitpause = 1
 
何时不应该启用NOKO:对手life=0,应取消NOKO,否则对手也无法被杀死。
注意大前提:自己和队友非濒死(life=0)
[State 0, VarSet];noko disable when ensure emeny ko
type = VarSet
TRIGGERALL = !IsHelper ;not shadow clone
triggerall = var(21) = 1
triggerall = ifelse(alive,ifelse(life>0,1,0),1) ;self must not ko incorrectly --- if alive, then must not life=0
triggerall = ifelse((partner,alive),ifelse((partner,life>0),1,0),1) ;partner must not ko incorrectly--- if alive, then must not life=0
trigger1 = NumEnemy = 1
trigger1 = EnemyNear(floor(fvar(36))),life=0 ;[0,1]
trigger1 = EnemyNear(floor(fvar(36))),alive
trigger2 = NumEnemy = 2
trigger2 = EnemyNear(floor(fvar(36))),life=0 ;[0,1]
trigger2 = EnemyNear(floor(fvar(36))),alive
trigger3 = NumEnemy = 2
trigger3 = EnemyNear(floor(fvar(36))+1),life=0 ;[0,1]
trigger3 = EnemyNear(floor(fvar(36))+1),alive
var(21) = 2
ignorehitpause = 1
 
NOKO断言。
注意胜利、失败、平局后,却处于roundstate = 2时,不应断言,否则对手即便已死,也会卡住,无法播放胜利动作。
[State 0, AssertSpecial]; ---- DO NOT CHANGE THIS!!!
type = AssertSpecial
TRIGGERALL = !IsHelper ;not shadow clone
triggerall = !((win || lose || drawgame) && roundstate = 2)
trigger1 = var(21) = 1
flag = noko
ignorehitpause = 1
 
—————————————————
综上所述,神代码副作用:
 
【无视当身的hitdef】:无
 
【永续target】:连击数不重置、对手/自己死亡后无法跳转到落幕
补救方法:不显示连击数(hitadd -999)、胜利/失败/平局后取消永续target
 
【superpause冻结】:无
 
【NOKO断言】:对手无法死亡、对手/自己死亡后无法跳转到落幕
补救方法:有条件的NOKO断言
 
—————————————————
缺陷:
 
120-155为mugen内建防御状态,当本体/队友处于这些状态时,生命操作不精确,会导致并非真正的1/2伤害
(会上下震荡极少伤害值,约为十几到几十)
 
连击数不显示。
 
队友必须可以被攻击到,若队友一直保持无敌,无法捕获,那也无可奈何。
 
队友被捕获前就死了,无可奈何。(神代码【苏生】可以办到,但是副作用及其巨大,不稳定易自杀,且无法用于新版mugen)
 
队友无敌时,常常错误的捕获到自己,再纠错放开自己,于是可见捕获成功前,自身在不断无敌受身。
 
【无视当身的hitdef】:面对神代码【冻结当身】无效。
 
【superpause冻结】:面对神代码【冻结解除】无效。
 
【NOKO断言】:面对神代码【超即死】、【直死】及更高神代码无效。
 
—————————————————
其他:
 
伊格尼斯的梦魇模式下,自身、队友、影之克隆各自分担“自身、队友”所受伤害的1/3。
即影之克隆是单向的分担。
影之克隆单向分担代码和此处不同,鉴于没有普适性,略去。
 
螺丝曾经使用单个变量循环记录,来记录损失的血量,而不是现在直接用总血量减去当前血量。
但之后被证实,虽然平时运作正常,但是一旦自身/队友处于120-155防御状态,则变量数据错位,
即使使用代码同步机制,或者避开防御状态,等防御结束再操作,也无法实现正确的生命均分。
根据高等神代码应用【140循环】,螺丝估计这里防御状态有隐藏干扰,所以该方案被作废。
 
生命均分效果会造成自身及队友有且仅有一方濒死时,濒死的一方无法被KO,直至自身和队友均濒死。
由于有条件的NOKO断言,偶尔会造成自身及队友“必须同时被打到life=0”方可被KO。


双人组队模式是mugen的一大特色,相关代码也比较繁琐。
组队AI、TAG换人系统等都基于该模式,虽然昙花一现,但是确实开辟了新天地。

螺丝在此概述以上两个古怪的神代码组队技能,希望能够抛砖引玉,
帮助大家变换思路,挖掘神代码用于普通角色的潜力。



暂无评论
根据相关规定,发布评论前必须绑定手机前往绑定
你,确定要这么做吗?
正在处理中...