public static void poison(Unit onDef, float damage) { if (Random.Range(0.0f, 100.0f) <= 40.0f) { BattleEventController.setAffect(onDef, (int)affect.poison, 2, 0.2f * damage); } }
public static void dazzle(Unit onDef) { if (Random.Range(0.0f, 100.0f) <= 10.0f) { BattleEventController.setAffect(onDef, (int)affect.missing, 2, 65.0f); } }
public static void defenceClick(bool value, int region) { isDefenceClicked = value; heroDefRegion = region; BattleEventController.isBoth(); Debug.Log("Event defenceClick created, isDefenceCliked = " + isDefenceClicked); Debug.Log("BattleEventController. defenceClick. region = " + heroDefRegion); }
public static void attackClick(bool value, int region) { isAttackClicked = value; heroAttackRegion = region; BattleEventController.isBoth(); Debug.Log("Event attackClick created, isAttackCliked = " + isAttackClicked); Debug.Log("BattleEventController. attackClick. region = " + heroAttackRegion); }
private IEnumerator Stagger() { isStaggered = true; BattleEventController.EnemyStaggered(); enemyEventController.Stagger(); yield return(new WaitForSeconds(stats.GetStaggerTime())); ResetStagger(); }
public void isBoth() { if (BattleEventController.isBoth()) { gameObject.GetComponent <Button> ().interactable = true; } else { gameObject.GetComponent <Button> ().interactable = false; } }
public void setNotReady() { Debug.Log("set not ready to true"); BattleEventController.setReady(false); isTrue = false; }
public void setReady() { Debug.Log("set ready to true"); BattleEventController.setReady(true); isTrue = true; }
public void defClick(int region) { Debug.Log("defence toggle selected with " + gameObject.GetComponent <Toggle>().isOn); BattleEventController.defenceClick(gameObject.GetComponent <Toggle>().isOn, region); }
public void attackClick(int region) { Debug.Log("attack toggle selected with " + gameObject.GetComponent <Toggle>().isOn); BattleEventController.attackClick(gameObject.GetComponent <Toggle>().isOn, region); }
public void Attack() { BattleEventController.PlayerHit(attackPower); isReady = false; BeginCooldown(); }
public static void hit(Unit onAt, Unit onDef, int attackRegion, int defRegion) { Debug.Log("Hit!"); float damage = onAt.getStats().GetStat((int)statName.damage); Debug.Log("Default damage " + damage); bool isMiss = false; bool isGodsHelp = false; if (onAt.getAffect((int)affect.missing).time > 0) { isMiss = Effects.miss(); onAt.decAffectTime((int)affect.missing); Debug.Log("wtf 1"); } else if (onDef.getEffect((int)effect.divineTear)) { isGodsHelp = Effects.divineTear(); Debug.Log("wtf 2"); } if (isMiss || isGodsHelp) { damage = 0; Debug.Log("wtf 3"); } else { float resist = onDef.getStats().GetStat((int)statName.resist); if (onAt.getEffect((int)effect.breakout)) { if (Effects.breakout()) { resist = resist / 2; } Debug.Log("wtf 5"); } if (onAt.getEffect((int)effect.concentrating)) { if (Effects.concentrating()) { damage = damage * 2; } Debug.Log("wtf 6"); } if (onAt.getEffect((int)effect.dazzle)) { Effects.dazzle(onDef); Debug.Log("wtf 7"); } if (onAt.getEffect((int)effect.poison)) { Effects.poison(onDef, damage); Debug.Log("wtf 8"); } if (onAt.getEffect((int)effect.vampirism)) { BattleEventController.updHealth(Effects.vampirism(damage), onAt); Debug.Log("wtf 9"); } if (attackRegion == defRegion) { damage -= resist; } else { damage -= resist / 2; } } Debug.Log("final damage" + damage); BattleEventController.updHealth(-damage, onDef); }
public static void step(int type) { Stats heroStats = EventController.hero.getStats(); Stats enemyStats = EventController.enemy.getStats(); int enemyAttackRegion = Random.Range((int)region.chest, (int)region.right_leg); int enemyDefRegion = Random.Range((int)region.chest, (int)region.right_leg); Debug.Log("New fight step with type = " + type); Debug.Log("Fight step. Enemy attack region = " + enemyAttackRegion.ToString()); Debug.Log("Fight step. Enemy defence region = " + enemyDefRegion.ToString()); BattleEventController.toDefault(); switch (type) { case (int)attackType.meele: Debug.Log("Fight. Step. Meele."); BattleEventController.toAttack(true); hit(EventController.hero, EventController.enemy, BattleEventController.heroAttackRegion, enemyDefRegion); // BattleEventController.setReady (false); break; case (int)attackType.magic: BattleEventController.toMagic(true); magicHit(EventController.enemy); BattleEventController.setReady(false); break; default: Debug.Log("Error! Wrong attack type"); break; } if (EventController.enemy.getAffect((int)affect.poison).time > 0) { BattleEventController.updHealth(EventController.enemy.getAffect((int)affect.poison).value, EventController.enemy); EventController.enemy.decAffectTime((int)affect.poison); } Debug.Log("Fight! Current health = " + enemyStats.GetCurPoints((int)statName.health)); if (enemyStats.GetCurPoints((int)statName.health) == 0.0f) { BattleEventController.toDeath(false); } else { BattleEventController.toAttack(false); hit(EventController.enemy, EventController.hero, enemyAttackRegion, BattleEventController.heroAttackRegion); Debug.Log("EventControler hero time = " + EventController.hero.getAffect((int)affect.poison).time); Debug.Log("EventControler hero time = " + EventController.enemy.getAffect((int)affect.poison).time); if (EventController.hero.getAffect((int)affect.poison).time > 0) { BattleEventController.updHealth(EventController.hero.getAffect((int)affect.poison).value, EventController.hero); EventController.hero.decAffectTime((int)affect.poison); } if (heroStats.GetCurPoints((int)statName.health) == 0) { BattleEventController.toDeath(true); } } }
public static void magicHit(Unit onDef) { BattleEventController.updHealth(-5, onDef); }
public static void setToBattle(Unit unit, bool isHero) { BattleEventController.setToBattle(unit, isHero); }