private StatusEffect DecideStatusEffect(SpellType type) { StatusEffect effect = null; switch (type) { case SpellType.Rejuvenation: effect = StatusEffect.CreateEffect(StatusEffect.EffectType.Healing, statusDamage, statusDuration); break; case SpellType.FireBall: effect = StatusEffect.CreateEffect(StatusEffect.EffectType.Burning, statusDamage, statusDuration); break; case SpellType.LightningBolt: break; default: break; } return(effect); }
private void CastIceWall(DamageInfo info) { if (isAOE) { Debug.LogError("NOT YET IMPLEMENTED!"); } else { // create script and it to the tile object. IceBlock ib = info.targetTile.gameObject.AddComponent <IceBlock>(); ib.CreateIceBlock(statusDuration, info.targetTile.position, info.targetTile.myType); // stun target. // set it to be invulnerable. if (info.targetTile.actor != null) { StatusEffect eff = StatusEffect.CreateEffect(StatusEffect.EffectType.Stun, 0, statusDuration); info.targetTile.actor.GetComponent <Actor>().AddStatusEffect(eff); eff = StatusEffect.CreateEffect(StatusEffect.EffectType.Invulnerable, 0, statusDuration); info.targetTile.actor.GetComponent <Actor>().AddStatusEffect(eff); } } }
public void Use() { int amount = 0; StatusEffect myEffect = null; foreach (Effects effect in useItemEffects) { switch (effect.type) { case Effects.EffectType.Heal: owner.GetComponent <Health>().HealDamage(Random.Range(effect.minAmount, effect.maxAmount)); break; case Effects.EffectType.Hurt: owner.GetComponent <Health>().TakeDamageSimple(Random.Range(effect.minAmount, effect.maxAmount)); break; case Effects.EffectType.ArmorBuff: amount = Random.Range(effect.minAmount, effect.maxAmount); myEffect = StatusEffect.CreateEffect( StatusEffect.EffectType.Armor, amount, effect.effectDuration); GUIManager.instance.CreatePopUpEntry("+Armor", owner.GetComponent <Actor>().position, GUIManager.PopUpType.Other); break; case Effects.EffectType.AttackBuff: amount = Random.Range(effect.minAmount, effect.maxAmount); myEffect = StatusEffect.CreateEffect( StatusEffect.EffectType.Attack, amount, effect.effectDuration); GUIManager.instance.CreatePopUpEntry("+Attack", owner.GetComponent <Actor>().position, GUIManager.PopUpType.Other); break; case Effects.EffectType.MaxHP: amount = Random.Range(effect.minAmount, effect.maxAmount); owner.GetComponent <Health>().maxHealth += amount; GUIManager.instance.CreatePopUpEntry("MaxHP +" + amount, owner.GetComponent <Actor>().position, GUIManager.PopUpType.Other); GUIManager.instance.CreateJournalEntry("Potion gave " + amount + " MaxHP.", GUIManager.JournalType.Item); break; case Effects.EffectType.HoT: myEffect = StatusEffect.CreateEffect( StatusEffect.EffectType.Healing, Random.Range(effect.minAmount, effect.maxAmount), effect.effectDuration); // Update GUI GUIManager.instance.CreatePopUpEntry("Healing", owner.GetComponent <Actor>().position, GUIManager.PopUpType.Heal); GUIManager.instance.CreateJournalEntry(owner.GetComponent <Actor>().actorName + " started healing.", GUIManager.JournalType.Status); break; case Effects.EffectType.DoT: myEffect = StatusEffect.CreateEffect( StatusEffect.EffectType.Bleeding, Random.Range(effect.minAmount, effect.maxAmount), effect.effectDuration); // Update GUI GUIManager.instance.CreatePopUpEntry("DoT", owner.GetComponent <Actor>().position, GUIManager.PopUpType.Heal); GUIManager.instance.CreateJournalEntry(owner.GetComponent <Actor>().actorName + " started bleeding.", GUIManager.JournalType.Status); break; case Effects.EffectType.ExpMultiplier: // usees only min amount! myEffect = StatusEffect.CreateEffect( StatusEffect.EffectType.ExpMultiplier, effect.minAmount, effect.effectDuration); GUIManager.instance.CreatePopUpEntry("ExpMult", owner.GetComponent <Actor>().position, GUIManager.PopUpType.Other); break; case Effects.EffectType.Stun: myEffect = StatusEffect.CreateEffect( StatusEffect.EffectType.Stun, Random.Range(effect.minAmount, effect.maxAmount), effect.effectDuration); GUIManager.instance.CreatePopUpEntry("Stun", owner.GetComponent <Actor>().position, GUIManager.PopUpType.Other); break; default: Debug.LogError("Can't find Effects.EffectType!"); break; } } if (myEffect != null) { owner.GetComponent <Actor>().AddStatusEffect(myEffect); } owner.GetComponent <Inventory>().currentUseItem = null; DestroyItem(); GUIManager.instance.UpdateAllElements(); // sound effect SoundManager.instance.PlaySound(SoundManager.Sound.useItem); }
private void HandleTraps() { foreach (GameObject tile in DungeonGenerator.instance.GetTiles()) { if (tile.GetComponent <Trap>() != null) { Trap trap = tile.GetComponent <Trap>(); // if the trap is activated on this turn. if (trap.GetActiveStatus() == Trap.State.Active) { if (trap.activatedOnTurn + trapDelayInTurns == turnCount) { // open spikes trap.UpdateGraphics(); // on next turn this trap will be inactive. trap.Deactivate(); Tile t = tile.GetComponent <Tile>(); // damage whoever is on the tile. if (t.actor != null) { // flying enemies dodge traps. if (t.actor.GetComponent <Actor>().canFly == false) { // set bleed effect. if (trapsCauseBleedEffect) { // create effect StatusEffect bleed = StatusEffect.CreateEffect( StatusEffect.EffectType.Bleeding, trapDoTDamage, trapDoTDuration); // add effect to the actor. t.actor.GetComponent <Actor>().AddStatusEffect(bleed); // gui stuff GUIManager.instance.CreatePopUpEntry("BLEEDING", t.position, GUIManager.PopUpType.Damage); GUIManager.instance.CreateJournalEntry( t.actor.GetComponent <Actor>().actorName + " started to bleed.", GUIManager.JournalType.Status); } // initial damage t.actor.GetComponent <Health>().TakeDamageSimple(trapInitialDamage); } } // turn the tile to a wall // -> actors can't step on spikes after their have popped out. t.myType = Tile.TileType.Wall; } } else if (trap.GetActiveStatus() == Trap.State.Inactive) { // close the spikes trap.UpdateGraphics(); // turn the tile to a floor again. tile.GetComponent <Tile>().myType = Tile.TileType.Floor; } } } }