public void takeDamagePrimary(SingleEffectResponse response) { // when call takeDamage, it means this is the opponent if (response.opponent_hp_change < 0) { if (response.type == SkillType.PHYSICAL) { response.opponent_hp_change = (int)(response.opponent_hp_change * detail.take_damage_total * detail.take_damage_physical); } if (response.type == SkillType.MAGICAL) { response.opponent_hp_change = (int)(response.opponent_hp_change * detail.take_damage_total * detail.take_damage_magical); } int newhp = detail.cur_hp + response.opponent_hp_change; newhp = newhp < 0 ? 0 : newhp; detail.cur_hp = newhp; } else if (response.opponent_hp_change > 0) { int newhp = detail.cur_hp + response.opponent_hp_change; newhp = newhp > detail.max_hp ? detail.max_hp : newhp; detail.cur_mp = newhp; } if (response.opponent_mp_change != 0) { int newmp = detail.cur_mp + response.opponent_mp_change; newmp = newmp < 0 ? 0 : newmp; newmp = newmp > detail.max_mp ? detail.max_mp : newmp; detail.cur_mp = newmp; } }
public virtual CounterEffectResponse takeDamage(SingleEffectResponse response) { // when call takeDamage, it means that // 1. this is the SkillEffectResponse.opponent // 2. this is the CounterEffectResponse.self // and CounterEffectResponse.self will be applied in this function return(null); }
public override CounterEffectResponse takeDamage(SingleEffectResponse response) { takeDamagePrimary(response); if (response.type == SkillType.PHYSICAL && response.stage == response.total - 1) { // when it takes counter, it means this is 'self' //CounterEffectResponse counter = new CounterEffectResponse (); //counter.opponent_hp_change = new List<int> (); //counter.opponent_hp_change.Add (atk); CounterEffectResponse counter = new CounterEffectResponse(); counter.opponent_hp_change = -detail.final_atk; return(counter); } else { return(null); } //return null; }
public SingleEffectResponse(SingleEffectResponse a) { type = a.type; self_hp_change = a.self_hp_change; //self_hp = a.self_hp; self_mp_change = a.self_mp_change; //self_mp = a.self_mp; opponent_hp_change = a.opponent_hp_change; //opponent_hp = a.opponent_hp; opponent_mp_change = a.opponent_mp_change; //opponent_mp = a.opponent_mp; self_buff_on = a.self_buff_on; self_buff_off = a.self_buff_off; opponent_buff_on = a.opponent_buff_on; opponent_buff_off = a.opponent_buff_off; total = a.total; stage = a.stage + 1; delay = a.delay; prefabPath = a.prefabPath; }
public override CounterEffectResponse takeDamage(SingleEffectResponse response) { takeDamagePrimary(response); return(null); }