public void SetupExplosion(float damage, float magnitude, Enums.DamageType dmgtype, Vector3 initpos, IEntity user) { explosion_type = dmgtype; explosion_damage = damage; explosion_magnitude = magnitude; transform.position = initpos; scaleMagnitude = INITIAL_SCALE; explosionAlpha = 1; explosion_user = user; gameObject.SetActive(true); }
private void SetColor(Enums.DamageType type) { switch (type) { case Enums.DamageType.normal: { notificationText.color = Color.white; break; } case Enums.DamageType.electricDamage: { notificationText.color = Color.yellow; break; } case Enums.DamageType.cryo: { notificationText.color = Color.cyan; break; } case Enums.DamageType.nuclearDamage: { notificationText.color = Color.blue; break; } case Enums.DamageType.photon: { notificationText.color = Color.red; break; } case Enums.DamageType.plasma: { notificationText.color = new Color(1, 0, 0.5f); break; } case Enums.DamageType.gamma: { notificationText.color = Color.green; break; } case Enums.DamageType.graviton: { notificationText.color = Color.magenta; break; } } }
public void DealDamage(float amount, Enums.DamageType dmgType, IEntity damageDealer) { if (amount <= 0) { return; } if (amount < 1) { amount = 1; } switch (dmgType) { case Enums.DamageType.normal: { SubstractHealthAndShield(amount, false); break; } case Enums.DamageType.photon: { if (!coRoutine_burning) { StartCoroutine("FireDamageOverTime"); } status_burning += amount; break; } case Enums.DamageType.cryo: { SubstractHealthAndShield(amount, false); status_frozen += amount; break; } case Enums.DamageType.nuclearDamage: { SubstractHealthAndShield(amount, true); break; } case Enums.DamageType.electricDamage: { SubstractHealthAndShield(amount, false); break; } } }
public void SetAsDamage(float dmg, bool crit, Enums.DamageType type, Vector3 worldpos) { isCrit = crit; notificationText.text = ((int)dmg).ToString(); transform.position = Camera.main.WorldToScreenPoint(worldpos); SetHorizontalAndVerticalSpeed(); SetColor(type); gameObject.SetActive(true); gameObject.transform.SetAsLastSibling(); if (isCrit) { StartCoroutine("AnimationCrit"); } else { StartCoroutine("AnimationNoCrit"); } }
public void Damage(int damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct) { User.Damage((double)damage, element, damageType); }
public void DisplayDamageNotification(float dmg, bool crit, Enums.DamageType type, Vector3 worldpos) { GetNotificationFromPool().SetAsDamage(dmg, crit, type, worldpos); }
public virtual void Damage(double damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct, Castables.DamageFlags damageFlags = Castables.DamageFlags.None, Creature attacker = null, bool onDeath = true) { if (attacker is User && this is Monster) { if (FirstHitter == null || !Game.World.ActiveUsersByName.ContainsKey(FirstHitter.Name) || ((DateTime.Now - LastHitTime).TotalSeconds > Constants.MONSTER_TAGGING_TIMEOUT)) { FirstHitter = attacker; } if (attacker != FirstHitter && !((FirstHitter as User).Group?.Members.Contains(attacker) ?? false)) { return; } } LastHitTime = DateTime.Now; if (damageType == Enums.DamageType.Physical && (AbsoluteImmortal || PhysicalImmortal)) { return; } if (damageType == Enums.DamageType.Magical && (AbsoluteImmortal || MagicalImmortal)) { return; } if (damageType != Enums.DamageType.Direct) { double armor = Stats.Ac * -1 + 100; var resist = Game.ElementTable[(int)element, 0]; var reduction = damage * (armor / (armor + 50)); damage = (damage - reduction) * resist; } if (attacker != null) { _mLastHitter = attacker.Id; } var normalized = (uint)damage; if (normalized > Stats.Hp && damageFlags.HasFlag(Castables.DamageFlags.Nonlethal)) { normalized = Stats.Hp - 1; } else if (normalized > Stats.Hp) { normalized = Stats.Hp; } Stats.Hp -= normalized; SendDamageUpdate(this); OnReceiveDamage(); // TODO: Separate this out into a control message if (Stats.Hp == 0 && onDeath == true) { OnDeath(); } }
public SpellSingleTarget(Enums.DamageType damageType, float damage) { _damageType = damageType; _damage = damage; }
public void DealDamage(float amount, Enums.DamageType dmgType, IEntity dmgDealer) { amount *= (1 - stat_defense); if (amount <= 0 || !gameObject.activeInHierarchy) { return; } bool isCrit = false; if (Random.Range(1, 101) < dmgDealer.GetCritChance() && dmgType != Enums.DamageType.electricEffect) { amount *= dmgDealer.GetCritMultiplier(); isCrit = true; } if (amount < 1) { amount = 1; } entityAI.NotifyDamageTaken(amount); switch (dmgType) { case Enums.DamageType.electricEffect: { ObjectPool.currentInstance.GetSparkFromPool().SetupSpark(transform.position, 5, amount, dmgDealer); break; } case Enums.DamageType.normal: { IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.normal, transform.position); SubstractHealthAndShield(amount, false); break; } case Enums.DamageType.plasma: { IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.plasma, transform.position); SubstractHealthAndShield(amount, false); stat_defense -= amount * DAMAGE_TO_VULNERABLE_STATUS_RATE; break; } case Enums.DamageType.photon: { status_burningStack += amount * DAMAGE_TO_BURNING_STATUS_RATE; status_burningTickDamage = status_burningStack / 20; status_burningTicksRemaining = 20; if (!coRoutine_burning) { StartCoroutine("FireDamageOverTime"); } SubstractHealthAndShield(amount, false); IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.photon, transform.position); break; } case Enums.DamageType.cryo: { IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.cryo, transform.position); if (status_frozen < 100) { status_frozen += amount * DAMAGE_TO_FROZEN_STATUS_RATE; if (status_frozen > 100) { status_frozen = 100; IngameHudManager.currentInstance.DisplayStatusNotification(Enums.StatusEffect.frozen, transform.position); } } status_frozenRecoveryRate = 0; if (!coRoutine_frozen) { StartCoroutine("FrozenStatus"); } SubstractHealthAndShield(amount, false); break; } case Enums.DamageType.nuclearDamage: { IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.nuclearDamage, transform.position); SubstractHealthAndShield(amount, true); break; } case Enums.DamageType.electricDamage: { IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.electricDamage, transform.position); SubstractHealthAndShield(amount, false); break; } case Enums.DamageType.gamma: { IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.gamma, transform.position); SubstractHealthAndShield(amount, false); break; } case Enums.DamageType.graviton: { IngameHudManager.currentInstance.DisplayDamageNotification(amount, isCrit, Enums.DamageType.graviton, transform.position); SubstractHealthAndShield(amount, false); break; } } }
public BuffEgyptian(float damage, Enums.DamageType damageType) : base(new Buff.BuffProperties(), float.PositiveInfinity) { _damage = damage; _damageType = damageType; }
public void SetMaxStacks(int stacks, int damage = 0, Enums.DamageType damageType = Enums.DamageType.none) { _maxStacks = stacks; }
public virtual void Damage(double damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct, Creature attacker = null) { if (damageType == Enums.DamageType.Physical && (AbsoluteImmortal || PhysicalImmortal)) { return; } if (damageType == Enums.DamageType.Magical && (AbsoluteImmortal || MagicalImmortal)) { return; } if (damageType != Enums.DamageType.Direct) { double armor = Ac * -1 + 100; var resist = Game.ElementTable[(int)element, 0]; var reduction = damage * (armor / (armor + 50)); damage = (damage - reduction) * resist; } if (attacker == null) { _mLastHitter = attacker.Id; } var normalized = (uint)damage; if (normalized > Hp) { normalized = Hp; } Hp -= normalized; SendDamageUpdate(this); }
public override void Damage(double damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct, DamageFlags damageFlags = DamageFlags.None, Creature attacker = null, bool onDeath = true) { return; }