2016.03.1321:26

AI HELPER-2.5 防御段位被破的记忆(进阶)

Episode 2.5 防御段位被破的记忆(进阶)

在读此文章之前先把上一篇认真读完并看懂大概意思

接下来先放出改进后的HELPER

;------------------------------------------------------------------------------
;ガードチェックヘルパー
;------------------------------------------------------------------------------
[Statedef 31000]
type = A
movetype = I
physics = N
anim = 0
velset = 0,0
sprpriority = 1
ctrl = 0

[State 31000, AssertSpecial]
type = AssertSpecial
Trigger1 = 1
flag = NoShadow
flag2 = invisible

[State 31000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 31000, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 31000, 間違いで本体が来たら立ちへ移行]
type = SelfState
trigger1 =!ishelper
value = 0

[State -3, 目の前の敵が一番近い相手である]
type = VarSet
triggerall = roundstate = 2
trigger1 = numenemy <= 1
trigger2 = numenemy >= 2
trigger2 = enemy(0),life <= 0 || enemy(1),life <= 0
trigger2 = enemynear(0),life > 0
trigger3 = numenemy >= 2
trigger3 = enemy(0),life > 0 && enemy(1),life > 0
trigger3 = abs(root,pos x - enemynear(0),pos x) <= abs(root,pos x - enemynear(1),pos x)
var(1) = 0
IgnoreHitPause = 1

[State -3, 目の前の敵が一番近い相手ではない]
type = VarSet
triggerall = roundstate = 2
triggerall = numenemy >= 2
trigger1 = enemynear(0),life <= 0
trigger2 = numenemy >= 2
trigger2 = enemy(0),life <= 0 || enemy(1),life <= 0
trigger2 = enemynear(0),life <= 0
trigger3 = enemy(0),life > 0 && enemy(1),life > 0
trigger3 = abs(root,pos x - enemynear(0),pos x) > abs(root,pos x - enemynear(1),pos x)
var(1) = 1
IgnoreHitPause = 1

;自分の後ろに設置 ――――――――――――――――――――――――――――――――――――――――
[State 31000, Turn]
type = Turn
trigger1 = facing*ifelse((enemynear(var(1)),pos x-pos x)>=0,1,-1) < 0
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

[State 31000, VarSet]
type = VarSet
trigger1 = enemynear(var(1)),facing*ifelse((enemynear(var(1)),pos x-root,pos x)>=0,1,-1)<=0
trigger2 = !enemynear(var(1)),hitdefattr = A,NA,SA,HA
var(2) = 0
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

[State 31000, VarSet]
type = VarSet
trigger1 = enemynear(var(1)),facing*ifelse((EnemyNear(var(1)),pos x-root,pos x)>=0,1,-1)>0
trigger1 = enemynear(var(1)),hitdefattr = A,NA,SA,HA
var(2) = 1
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

[State 31000, PosSet]
type = PosSet
trigger1 = 1
x = root,pos x+ifelse((enemynear(var(1)),pos y<0&&var(2)=1),(enemynear(var(1)),const(size.attack.dist)),(enemynear(var(1)),const(size.proj.attack.dist)))*(enemynear(var(1)),facing)
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

;---------------------------------------------------------------------------
[State 31000, リセット]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,StateNo != [120,155]
Trigger1 = Root,MoveType!= H
Trigger1 = Root,Ctrl = 1 && var(50) > 0
Trigger2 = Root,MoveType = H
Trigger2 = Root,Time > 1 && var(50) > 0
var(50) = 0
IgnoreHitPause = 1

;分别记下来防御中站立,蹲下,空中(可有可无)情况

[State 31000, 立ちガード時学習用]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,StateNo = [120,155]
Trigger1 = Root,StateType = S
var(50) = 1
IgnoreHitPause = 1

[State 31000, 下段ガード時学習用]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,StateNo = [120,155]
Trigger1 = Root,StateType = C
var(50) = 2
IgnoreHitPause = 1

[State 31000, 空中ガード時学習用]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,StateNo = [120,155]
Trigger1 = Root,StateType = A
var(50) = 3
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, リセット]
Type = VarSet
Trigger1 = 1
var(51) = 0
IgnoreHitPause = 1

[State 31000, 特殊状態記憶] ;重点在这里,记录下本体被打并且不是站立也不是蹲下的情况
Type = VarSet
TriggerAll = Root,var(59) = 1
Trigger1 = Root,MoveType = H && Root,StateType != S && Root,StateType != C && (Root,StateNo != [120,155])
var(51) = 1
IgnoreHitPause = 1

;---------------------------------------------------------------------------
;ガード学習
;---------------------------------------------------------------------------
[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1 ;这里记录下特殊情况,下面也是一样
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = C || var(50) = 2)
Trigger1 = var(10) = 0
V = 10
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10)
Trigger1 = var(10) > 0
Trigger1 = var(11) = 0
V = 11
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(11)
Trigger1 = var(11) > 0
Trigger1 = var(12) = 0
V = 12
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(11)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(12)
Trigger1 = var(12) > 0
Trigger1 = var(13) = 0
V = 13
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(11)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(12)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(13)
Trigger1 = var(13) > 0
Trigger1 = var(14) = 0
V = 14
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = S || var(50) = 1)
Trigger1 = var(20) = 0
V = 20
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
Trigger1 = var(20) > 0
Trigger1 = var(21) = 0
V = 21
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(21)
Trigger1 = var(21) > 0
Trigger1 = var(22) = 0
V = 22
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(21)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(22)
Trigger1 = var(22) > 0
Trigger1 = var(23) = 0
V = 23
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(21)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(22)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(23)
Trigger1 = var(23) > 0
Trigger1 = var(24) = 0
V = 24
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(10)
Trigger1 = var(10) > 0
V = 10
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(11)
Trigger1 = var(11) > 0
V = 11
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(12)
Trigger1 = var(12) > 0
V = 12
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(13)
Trigger1 = var(13) > 0
V = 13
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != A && (Root,StateType = S || var(50) = 1)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(14)
Trigger1 = var(14) > 0
V = 14
Value = 0
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(20)
Trigger1 = var(20) > 0
V = 20
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(21)
Trigger1 = var(21) > 0
V = 21
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(22)
Trigger1 = var(22) > 0
V = 22
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(23)
Trigger1 = var(23) > 0
V = 23
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) || Root,StateNo >= 200 && var(51) = 1
TriggerAll = EnemyNear(Root,var(58)),StateType != C && (Root,StateType = C || var(50) = 2)
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(24)
Trigger1 = var(24) > 0
V = 24
Value = 0
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, DisplayToClipBoard]
Type = DisplayToClipBoard
trigger1 = IsHelper
Text = "var(10)=%d,var(11)=%d,var(12)=%d,var(13)=%d,var(14)=%d"
Params = var(10),var(11),var(12),var(13),var(14)
IgnoreHitPause = 1

[State 31000, AppendToClipboard]
type = AppendToClipboard
trigger1 = IsHelper
text = "\nvar(20)=%d,var(21)=%d,var(22)=%d,var(23)=%d,var(24)=%d"
params = var(20),var(21),var(22),var(23),var(24)
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, DestroySelf]
type = DestroySelf
triggerall = ishelper
triggerall = roundstate >= 3
trigger1 = root,stateno != [120,159]
trigger2 = roundstate >= 4

和前面一样,就是多加了两个var,记下来root,statetype情况和本体被击飞或者被强制倒地的情况

因为本来上节课那么写的是不能记下来被击飞或者强制倒地的情况的,只能记录root,statetype = S或者root,statetype = C的情况

下面来给出示例图,可以放大图片看下面的DEBUG数据

这是未记录任何被破情况
这个是未记录任何被破情况

此时下段被破了,记录下下段
此时下段被破了,记录下下段StateNo

下次就不会再吃了
那么下次就不会再吃了

中段
中段技也一样,先是被打了

下次也不会再吃了
同理,下次也不会再吃了


所以这次呢,不妨大家试用一下我改进以后的防御记忆HELPER

好了,今天的课就先到这,如果您有什么问题的话可以私信我,我会第一时间给您答复,或者把问题发到我的邮箱

mizore@kotori.moe, 谢谢大家!

发表留言

秘密留言

等待许可的留言

此留言需要管理员的许可

等待许可的留言

此留言需要管理员的许可

等待许可的留言

此留言需要管理员的许可

等待许可的留言

此留言需要管理员的许可

アクセス

オンライン