本帖最后由 阿斯顿发生 于 2022-9-15 10:04 编辑
先是script里头
("cf_non_normal_physics_damage_over_time_template",
[
(store_script_param,":agent_defender",1),
(store_script_param,":agent_attacker",2),
(store_script_param,":school",3), #这个参数是决定魔法伤害的派系. 0=fake magic不属于任何派系 1=illusion(幻术) 2=mysticism(神秘) 3=engineer(alteration使用的是原来的工程,变化系) 4=wound_treatment (restoration,使用原来的疗伤,恢复系) 5=destruction(毁灭)
(store_script_param,":kind",4),#这个参数是伤害的类型. 0=no kind(传说中的真实伤害) 1=火 2=冰 3=闪电 4=流血 5=毒 6=疾病 7=神圣 8=黑暗 9=魔法
(store_script_param,":damage_base",5), # 一个基础的伤害值
(store_script_param,":time",6), # 伤害持续的时间
(get_player_agent_no,":player"),
(agent_get_troop_id,":agent_troop_a", ":agent_attacker"),
(agent_get_slot,":unnormal",":agent_defender",slot_agent_unnoraml),#这里的slot是用来计算特殊倍率的,比如吸血鬼额外火伤,亡灵额外神圣伤害等等
(agent_get_slot,":resistant",":agent_defender",slot_agent_magicresistant),#还需要一个slot作为魔抗
下面是技能倍率加成,可以随便改,我这个大概就是所有有派系的魔法,在技能等于15的时候会比没有技能的多1.5倍左右的伤害,合计为基础的2.5倍,注意0不可以被除,要单独写一下,当初我被这个坑惨了###
(try_begin),
###fake magic###
(eq,":school",0),
(store_mul,":damage_1",":damage_base",1),
###illusion###
(else_try),
(eq,":school",1),
(store_skill_level,":askill", "skl_illusion" ,":agent_troop_a"),
(try_begin),
(eq,":askill",0),
(store_mul,":damage_1",":damage_base",1),
(else_try),
(store_mul,":damage_1",":damage_base",":askill"),
(val_div,":damage_1",10),
(val_add,":damage_1",":damage_base"),
(try_end),
###mysticism###
(else_try),
(eq,":school",2),
(store_skill_level,":askill", "skl_mysticism" ,":agent_troop_a"),
(try_begin),
(eq,":askill",0),
(store_mul,":damage_1",":damage_base",1),
(else_try),
(store_mul,":damage_1",":damage_base",":askill"),
(val_div,":damage_1",10),
(val_add,":damage_1",":damage_base"),
(try_end),
###alteration###
(else_try),
(eq,":school",3),
(store_skill_level,":askill", "skl_engineer" ,":agent_troop_a"),
(try_begin),
(eq,":askill",0),
(store_mul,":damage_1",":damage_base",1),
(else_try),
(store_mul,":damage_1",":damage_base",":askill"),
(val_div,":damage_1",10),
(val_add,":damage_1",":damage_base"),
(try_end),
###restoration###
(else_try),
(eq,":school",4),
(store_skill_level,":askill", "skl_wound_treatment" ,":agent_troop_a"),
(try_begin),
(eq,":askill",0),
(store_mul,":damage_1",":damage_base",1),
(else_try),
(store_mul,":damage_1",":damage_base",":askill"),
(val_div,":damage_1",10),
(val_add,":damage_1",":damage_base"),
(try_end),
###destruction###
(else_try),
(eq,":school",5),
(store_skill_level,":askill", "skl_destruction" ,":agent_troop_a"),
(try_begin),
(eq,":askill",0),
(store_mul,":damage_1",":damage_base",1),
(else_try),
(store_mul,":damage_1",":damage_base",":askill"),
(val_div,":damage_1",10),
(val_add,":damage_1",":damage_base"),
(try_end),
(try_end),
#接下来是计算种族特异倍率,我这里随便写的几个,至于":unnormal"里的数字到底对应了什么特殊种族,可以根据slot_agent_unnoraml来另写一个脚本
(try_begin),
###真实伤害###
(eq,":kind",0),
(store_mul,":damage_2",":damage_1",1),
###火###
(else_try),
(eq,":kind",1),
(try_begin),
(eq,":unnormal",2),
(store_mul,":damage_2",":damage_1",2),
(else_try),
(eq,":unnormal",4),
(store_div,":damage_2",":damage_1",2),
(else_try),
(store_div,":damage_2",":damage_1",1),
(try_end),
###冰###
(else_try),
(eq,":kind",2),
(try_begin),
(this_or_next|eq,":unnormal",2),
(eq,":unnormal",5),
(store_mul,":damage_2",":damage_1",0),
(else_try),
(store_mul,":damage_2",":damage_1",1),
(try_end),
###闪电###
(else_try),
(eq,":kind",3),
(try_begin),
(eq,":unnormal",2),
(store_div,":damage_2",":damage_1",2),
(else_try),
(eq,":unnormal",9),
(store_mul,":damage_2",":damage_1",0),
(else_try),
(store_mul,":damage_2",":damage_1",1),
(try_end),
###流血###
(else_try),
(eq,":kind",4),
(try_begin),
(this_or_next|eq,":unnormal",0),
(this_or_next|eq,":unnormal",1),
(this_or_next|eq,":unnormal",3),
(this_or_next|eq,":unnormal",7),
(eq,":unnormal",8),
(store_mul,":damage_2",":damage_1",1),
(else_try),
(store_mul,":damage_2",":damage_1",0),
(try_end),
###毒###
(else_try),
(eq,":kind",5),
(try_begin),
(eq,":unnormal",0),
(store_mul,":damage_2",":damage_1",1),
(else_try),
(eq,":unnormal",3),
(store_mul,":damage_2",":damage_1",2),
(else_try),
(store_mul,":damage_2",":damage_1",0),
(try_end),
###疾病###
(else_try),
(eq,":kind",6),
(try_begin),
(eq,":unnormal",0),
(store_mul,":damage_2",":damage_1",1),
(else_try),
(store_mul,":damage_2",":damage_1",0),
(try_end),
###神圣###
(else_try),
(eq,":kind",7),
(try_begin),
(this_or_next|eq,":unnormal",1),
(eq,":unnormal",6),
(store_mul,":damage_2",":damage_1",2),
(else_try),
(eq,":unnormal",7),
(store_div,":damage_2",":damage_1",2),
(else_try),
(eq,":unnormal",8),
(store_mul,":damage_2",":damage_1",0),
(else_try),
(this_or_next|eq,":unnormal",2),
(this_or_next|eq,":unnormal",3),
(eq,":unnormal",5),
(store_mul,":damage_2",":damage_1",3),
(else_try),
(store_mul,":damage_2",":damage_1",1),
(try_end),
###黑暗###
(else_try),
(eq,":kind",8),
(try_begin),
(this_or_next|eq,":unnormal",1),
(eq,":unnormal",6),
(store_div,":damage_2",":damage_1",2),
(else_try),
(eq,":unnormal",8),
(store_mul,":damage_2",":damage_1",2),
(else_try),
(this_or_next|eq,":unnormal",9),
(eq,":unnormal",2),
(store_mul,":damage_2",":damage_1",0),
(else_try),
(store_mul,":damage_2",":damage_1",1),
(try_end),
###魔法###
(else_try),
(eq,":kind",9),
(try_begin),
(eq,":unnormal",2),
(store_div,":damage_2",":damage_1",2),
(else_try),
(eq,":unnormal",4),
(store_div,":damage_2",":damage_1",2),
(else_try),
(store_mul,":damage_2",":damage_1",1),
(try_end),
(try_end),
#如果上面计算的结果小于0,或为0,那么我们可以直接让这个脚本失败,因为我们要的是大于0的有效伤害#
(gt,":damage_2",0), #如果小于0或等于0,令这个脚本无法运行
#开始计算抗性减免
(try_begin),
###真实伤害不吃抗性###
(eq,":kind",0),
(store_mul,":damage_3",":damage_2",1),
###计算抗性,注意和计算加成一样,0不可以被除,还是要单独写一下###
(else_try),
(try_begin),
(eq,":resistant",0),
(store_mul,":damage_3",":damage_2",1),
(else_try),
(store_mul,":damage_4",":resistant",":damage_2"),
(val_div,":damage_4",100),
(store_sub,":damage_3",":damage_2",":damage_4"),
(try_end),
(try_end),
#再次确认伤害大于0,然后我们可以记录这个伤害#
(gt,":damage_3",0),
(agent_set_slot,":agent_defender",slot_agent_damage_will_take,":damage_3"), #储存伤害
(agent_set_slot,":agent_defender",slot_agent_damage_dealer,":agent_attacker"), #记录攻击者
(agent_set_slot,":agent_defender",slot_agent_damage_time,":time"),#确认时间
]),
然后是第二个脚本,主要有一个就是在agent空血的时候处决掉他,因为之前的“伤害”实质是操纵hp条,就算到0也不会死,所以要给个伤害,这也是为什么上面的脚本要有储存攻击者的slot
("cf_agent_damage_over_time",
[
(store_script_param,":agent",1),
(agent_get_slot,":time",":agent",slot_agent_buff_or_debuff_time),
(agent_get_slot,":damage",":agent",slot_agent_damage_will_take),
(agent_get_slot,":dealer",":agent",slot_agent_damage_dealer),
(ge,":time",1),
(gt,":dealer",0),
(gt,":damage",0),
(val_sub,":time",1),
#(else_try)下面才是伤害,上头的是操纵hp
(store_agent_hit_points,":hp",":agent",1),
(try_begin),
(ge,":hp",1),
(val_sub,":hp",":damage"),
(agent_set_hit_points,":agent",":hp",1),
(agent_set_slot,":agent",slot_agent_buff_or_debuff_time,":time"),#设置新时间为原来的减去1,如果大于等于1就继续
(else_try),
(agent_deliver_damage_to_agent, ":dealer", ":agent", ":damage"),#agent已经被处决了,所以他死了就不需要设置时间了
(try_end),
]),
而好巧不巧,我正发愁,为了防止那种,低级兵叠buff把高级兵叠死的问题,我突然意识到,伤害和时间都是写在slot里的,所以下一个调用这个模板的持续性伤害会把上个没有打完的伤害给覆盖掉,也就是每个agent,在同一时刻只能吃到一个dot,这就很爽
然后是mt里头
(1, 0, 0,
[],
[
(try_for_agents, ":agent"),
(agent_is_alive,":agent"), #承上所述,agent如果死了就不用在意时间了
(call_script,"script_cf_agent_damage_over_time",":agent"),
(try_end),
]),
最后别忘了把所有使用的slot加到constants的agent slot那个专栏下面对了还有技能得加到skills里面,不过这两个都简单就是废点时间
|