public virtual void takeCounterEffect(CounterEffectResponse response) { // when call takeCounterEffect, it means this is the opponent if (response.opponent_hp_change < 0) { response.opponent_hp_change = (int)(response.opponent_hp_change * detail.take_damage_total); 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; } }
private void recieveSingleEffect(int stage) { if (turnState == Turn.HERO) { // display effect and damage // apply buff first hero_buff_list.addBuffs(response.effects[stage].self_buff_on); hero_buff_list.removeBuffs(response.effects[stage].self_buff_off); monster_buff_list.addBuffs(response.effects [stage].opponent_buff_on); monster_buff_list.removeBuffs(response.effects [stage].opponent_buff_off); // buff take effect hero_buff_list.takeBuffEffect(); monster_buff_list.takeBuffEffect(); // take damage CounterEffectResponse counter = monster.takeDamage(response.effects[stage]); // display buff and damage displaySingleEffect(true, stage); updateCreatureState(); if (counter != null) { dispalySkillTexts(false, counter.name, 0.0f, 1.2f, null); hero.takeCounterEffect(counter); displayCounterEffect(false, counter); updateCreatureState(); } counter = null; } else { } }
private float displayCounterEffect(bool left_is_self, CounterEffectResponse response) { if (response == null) { return(0.0f); } ; float sx = left_is_self ? -467.5f : 467.5f; float ox = -sx; float sdelay = 0.0f; int tmp = response.self_hp_change; if (tmp != 0) { if (tmp > 0) { createScrollingText(new Vector2(sx, 0), "+" + tmp.ToString(), MyColor.HpRecover, sdelay, 2.4f, null, state); } else { createScrollingText(new Vector2(sx, 0), tmp.ToString(), MyColor.HpColor, sdelay, 2.4f, null, state); } sdelay += 0.2f; } tmp = response.self_mp_change; if (tmp > 0) { createScrollingText(new Vector2(sx, 0), "+" + tmp.ToString(), MyColor.MpColor, sdelay, 2.4f, null, state); sdelay += 0.2f; } float odelay = 0.0f; tmp = response.opponent_hp_change; if (tmp != 0) { if (tmp > 0) { createScrollingText(new Vector2(ox, 0), "+" + tmp.ToString(), MyColor.HpRecover, odelay, 2.4f, null, state); } else { createScrollingText(new Vector2(ox, 0), tmp.ToString(), MyColor.HpColor, odelay, 2.4f, null, state); } odelay += 0.2f; } tmp = response.opponent_mp_change; if (tmp < 0) { createScrollingText(new Vector2(ox, 0), tmp.ToString(), MyColor.MpColor, odelay, 2.4f, null, state); odelay += 0.2f; } return(sdelay > odelay ? sdelay : odelay); }
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; }