void OnEquipmentChanged(Equipment newItem, Equipment oldItem) { if (newItem != null) { HP.AddModifier(newItem.HP_modifier); MP.AddModifier(newItem.MP_modifier); PhysicalAttack.AddModifier(newItem.PhysicalAttack_modifier); PhysicalDefense.AddModifier(newItem.PhysicalDefense_modifier); MagicalAttack.AddModifier(newItem.MagicalAttack_modifier); MagicalDefense.AddModifier(newItem.MagicalDefense_modifier); CriticalRate.AddModifier(newItem.CriticalRate_modifier); UpdateStats(); } if (oldItem != null) { HP.AddModifier(oldItem.HP_modifier); MP.AddModifier(oldItem.MP_modifier); PhysicalAttack.AddModifier(oldItem.PhysicalAttack_modifier); PhysicalDefense.AddModifier(oldItem.PhysicalDefense_modifier); MagicalAttack.AddModifier(oldItem.MagicalAttack_modifier); MagicalDefense.AddModifier(oldItem.MagicalDefense_modifier); CriticalRate.AddModifier(oldItem.CriticalRate_modifier); UpdateStats(); } }
private void CreateNewData() { AssetDatabase.CreateAsset(_ability, "Assets/Scriptable Objects/Abilities/Physical/" + _name + ".asset"); AssetDatabase.SaveAssets(); _ability = CreateInstance <PhysicalAttack>(); }
protected override AttackMode GetAttackMode() { PhysicalAttack p = new PhysicalAttack(DesignFilter()); Bullet b = new Bullet(Resources.Load("Bullets/bullet") as GameObject, new Vector3(transform.position.x, transform.position.y * 1.5f, transform.position.z)); return(new AttackMode(p, b)); }
private PhysicalAttack ApplyPhysicalDamage(PhysicalAttack attack) { var missChance = (Monster.Dodge - attack.AttackersHitrate) * 0.01; if (new Random().NextDouble() < missChance) { attack.Status = AttackStatus.Missed; attack.Damage = 0; return(attack); } var totalPierce = Monster.Defense * attack.Pierce * 0.011; var reducedDamage = attack.Damage - (int)Math.Ceiling(attack.Damage * Monster.Resistance * 0.01 + Monster.Defense - totalPierce); reducedDamage = reducedDamage <= 0 ? 1 : reducedDamage; attack.Damage = reducedDamage; if (attack.Status == AttackStatus.Critical) { attack.Damage = (int)(Math.Ceiling(attack.Damage * attack.CriticalFactor)); } Health -= attack.Damage; return(attack); }
protected override AttackMode GetAttackMode() { PhysicalAttack p = new PhysicalAttack(DesignFilter()); Melee m = new Melee(); return(new AttackMode(p, m)); }
private PhysicalAttack ApplyPhysicalDamage(PhysicalAttack attack) { var missChance = (Dodge - attack.AttackersHitrate) * 0.01; if (new Random().NextDouble() < missChance) { attack.Status = AttackStatus.Missed; attack.Damage = 0; return(attack); } var reducedDamage = attack.Damage - (int)Math.Ceiling(attack.Damage * Resistance * 0.01 + Defense); reducedDamage = reducedDamage <= 0 ? 1 : reducedDamage; attack.Damage = reducedDamage; if (attack.Status == AttackStatus.Critical) { attack.Damage *= 2; } Health -= attack.Damage; return(attack); }
public Attack AttackTarget(ICombatable target, IEventDispatcher eventDispatcher) { Attack attack = new PhysicalAttack(this, MinAttack, MaxAttack, Hitrate, Luck); if (DamageType == DamageType.Magical) { attack = new MagicAttack(this, Intelligence); } return(target.ReceiveAttack(attack, eventDispatcher)); }
public Attack AttackTarget(ICombatable target, IEventDispatcher eventDispatcher) { Attack attack = new PhysicalAttack(this, Monster.MinAttack, Monster.MaxAttack, Monster.Hitrate, Monster.GetCriticalHitChance(), 2, 0); if (Monster.DamageType == DamageType.Magical) { attack = new MagicAttack(this, Monster.MaxAttack); } return(target.ReceiveAttack(attack, eventDispatcher)); }
protected virtual void Start() { currentLife = maxLife; currentMana = maxMana; if (currentCamp == Camp.Player) { CombatManager.instance.playerEntities.Add(this); } else if (currentCamp == Camp.Enemy) { CombatManager.instance.enemyEntities.Add(this); } physicalAttack = GetComponent <PhysicalAttack>(); magicalAttack = GetComponent <MagicAttack>(); heal = GetComponent <Heal>(); gambit = GetComponent <GambitSystem.Gambit>(); }
public override async Task <DougResponse> Activate(User user, ICombatable target, string channel) { if (!CanActivateSkill(user, out var response)) { return(response); } var message = string.Format(DougMessages.UserActivatedSkill, _userService.Mention(user), Name); await _slack.BroadcastMessage(message, channel); var damage = 5 * user.TotalAgility() + 150; var attack = new PhysicalAttack(user, damage, int.MaxValue); target.ReceiveAttack(attack, _eventDispatcher); await _combatService.DealDamage(user, attack, target, channel); return(new DougResponse()); }