public ClickAttackButtonEventArgs Fill(WeaponAttackType attackType, int?weaponID = null) { AttackType = attackType; WeaponID = weaponID; return(this); }
public void _ApplyWeaponDamage(byte slot, Item item, bool apply) { ItemTemplate proto = item.GetTemplate(); WeaponAttackType attType = GetAttackBySlot(slot, proto.GetInventoryType()); if (!IsInFeralForm() && apply && !CanUseAttackType(attType)) { return; } float damage = 0.0f; uint itemLevel = item.GetItemLevel(this); float minDamage, maxDamage; proto.GetDamage(itemLevel, out minDamage, out maxDamage); if (minDamage > 0) { damage = apply ? minDamage : SharedConst.BaseMinDamage; SetBaseWeaponDamage(attType, WeaponDamageRange.MinDamage, damage); } if (maxDamage > 0) { damage = apply ? maxDamage : SharedConst.BaseMaxDamage; SetBaseWeaponDamage(attType, WeaponDamageRange.MaxDamage, damage); } SpellShapeshiftFormRecord shapeshift = CliDB.SpellShapeshiftFormStorage.LookupByKey(GetShapeshiftForm()); if (proto.GetDelay() != 0 && !(shapeshift != null && shapeshift.CombatRoundTime != 0)) { SetBaseAttackTime(attType, apply ? proto.GetDelay() : SharedConst.BaseAttackTime); } int weaponBasedAttackPower = apply ? (int)(proto.GetDPS(itemLevel) * 6.0f) : 0; switch (attType) { case WeaponAttackType.BaseAttack: SetMainHandWeaponAttackPower(weaponBasedAttackPower); break; case WeaponAttackType.OffAttack: SetOffHandWeaponAttackPower(weaponBasedAttackPower); break; case WeaponAttackType.RangedAttack: SetRangedWeaponAttackPower(weaponBasedAttackPower); break; default: break; } if (CanModifyStats() && (damage != 0 || proto.GetDelay() != 0)) { UpdateDamagePhysical(attType); } }
public void GetWeapon() { posX = weapon.localPosition.x; weaponAttributes = weapon.GetComponent <WeaponAttributes>(); attackRangeX = weaponAttributes.attackRangeX; attackRangeY = weaponAttributes.attackRangeY; weaponAttackType = weaponAttributes.weaponAttackType; weaponMass = weaponAttributes.mass; switch (weaponAttributes.weaponUltimate.type) { case WeaponUltimate.Passive: movement.bonusAttributes = weaponAttributes.weaponUltimate.attributes; break; case WeaponUltimate.Buff: break; case WeaponUltimate.Charging: break; case WeaponUltimate.Spell: break; } }
/// <summary> /// 选择指定的武器开火 /// </summary> /// <param name="attackType"></param> /// <param name="weaponID"></param> public void FireWeapon(WeaponAttackType attackType, int weaponID) { Weapon weapon = null; switch (attackType) { case WeaponAttackType.手动触发: weapon = manualWeapons.Where(w => w.GetTypeId() == weaponID).SingleOrDefault(); break; case WeaponAttackType.自动触发: weapon = autoWeapons.Where(w => w.GetTypeId() == weaponID).SingleOrDefault(); break; case WeaponAttackType.技能触发: weapon = skillWeapons.Where(w => w.GetTypeId() == weaponID).SingleOrDefault(); break; } if (weapon != null) { if (weapon.CostMP > 0 && fightEntityData.MP < weapon.CostMP) { return; } fightEntityData.CostMP(weapon.CostMP); weapon.Attack(fightEntityData.Atk); OnFireWeapon(); } }
public CleanDamage(uint mitigated, uint absorbed, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) { absorbed_damage = absorbed; mitigated_damage = mitigated; attackType = _attackType; hitOutCome = _hitOutCome; }
public DamageInfo(Unit attacker, Unit victim, uint damage, SpellInfo spellInfo, SpellSchoolMask schoolMask, DamageEffectType damageType, WeaponAttackType attackType) { m_attacker = attacker; m_victim = victim; m_damage = damage; m_spellInfo = spellInfo; m_schoolMask = schoolMask; m_damageType = damageType; m_attackType = attackType; }
public override void UpdateDamagePhysical(WeaponAttackType attType) { if (attType > WeaponAttackType.BaseAttack) { return; } float bonusDamage = 0.0f; Player playerOwner = m_owner.ToPlayer(); if (playerOwner != null) { //force of nature if (GetEntry() == ENTRY_TREANT) { int spellDmg = playerOwner.m_activePlayerData.ModDamageDonePos[(int)SpellSchools.Nature] - playerOwner.m_activePlayerData.ModDamageDoneNeg[(int)SpellSchools.Nature]; if (spellDmg > 0) { bonusDamage = spellDmg * 0.09f; } } //greater fire elemental else if (GetEntry() == ENTRY_FIRE_ELEMENTAL) { int spellDmg = playerOwner.m_activePlayerData.ModDamageDonePos[(int)SpellSchools.Fire] - playerOwner.m_activePlayerData.ModDamageDoneNeg[(int)SpellSchools.Fire]; if (spellDmg > 0) { bonusDamage = spellDmg * 0.4f; } } } UnitMods unitMod = UnitMods.DamageMainHand; float att_speed = GetBaseAttackTime(WeaponAttackType.BaseAttack) / 1000.0f; float base_value = GetFlatModifierValue(unitMod, UnitModifierFlatType.Base) + GetTotalAttackPowerValue(attType, false) / 3.5f * att_speed + bonusDamage; float base_pct = GetPctModifierValue(unitMod, UnitModifierPctType.Base); float total_value = GetFlatModifierValue(unitMod, UnitModifierFlatType.Total); float total_pct = GetPctModifierValue(unitMod, UnitModifierPctType.Total); float weapon_mindamage = GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MinDamage); float weapon_maxdamage = GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MaxDamage); float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct; float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct; SetUpdateFieldStatValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.MinDamage), mindamage); SetUpdateFieldStatValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.MaxDamage), maxdamage); }
public override void UpdateDamagePhysical(WeaponAttackType attType) { if (attType > WeaponAttackType.BaseAttack) { return; } float bonusDamage = 0.0f; if (GetOwner().IsTypeId(TypeId.Player)) { //force of nature if (GetEntry() == ENTRY_TREANT) { int spellDmg = GetOwner().GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Nature) - GetOwner().GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Nature); if (spellDmg > 0) { bonusDamage = spellDmg * 0.09f; } } //greater fire elemental else if (GetEntry() == ENTRY_FIRE_ELEMENTAL) { int spellDmg = GetOwner().GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire) - GetOwner().GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire); if (spellDmg > 0) { bonusDamage = spellDmg * 0.4f; } } } UnitMods unitMod = UnitMods.DamageMainHand; float att_speed = GetBaseAttackTime(WeaponAttackType.BaseAttack) / 1000.0f; float base_value = GetModifierValue(unitMod, UnitModifierType.BaseValue) + GetTotalAttackPowerValue(attType) / 3.5f * att_speed + bonusDamage; float base_pct = GetModifierValue(unitMod, UnitModifierType.BasePCT); float total_value = GetModifierValue(unitMod, UnitModifierType.TotalValue); float total_pct = GetModifierValue(unitMod, UnitModifierType.TotalPCT); float weapon_mindamage = GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MinDamage); float weapon_maxdamage = GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MaxDamage); float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct; float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct; SetStatFloatValue(UnitFields.MinDamage, mindamage); SetStatFloatValue(UnitFields.MaxDamage, maxdamage); }
/// <summary> /// For range attacks. In arrays indicate values in order /// </summary> public EnemyCombo(int attackCount, WeaponAttackType attackType, int chance, int[] damage, float[] timeBtwAttack, float[] dazedTime, float attackCD, float attackRange, Vector2[] repulseDistantion, Element element = new Element()) { this.attackCount = attackCount; this.attackType = attackType; this.chance = chance; this.damage = damage; this.timeBtwAttack = timeBtwAttack; this.dazedTime = dazedTime; this.attackCD = attackCD; this.repulseDistantion = repulseDistantion; this.attackRange = attackRange; this.element = element; attackClips = null; }
public override bool CanUseAttackType(WeaponAttackType attacktype) { switch (attacktype) { case WeaponAttackType.BaseAttack: return(!HasFlag(UnitFields.Flags, UnitFlags.Disarmed)); case WeaponAttackType.OffAttack: return(!HasFlag(UnitFields.Flags2, UnitFlags2.DisarmOffhand)); case WeaponAttackType.RangedAttack: return(!HasFlag(UnitFields.Flags2, UnitFlags2.DisarmRanged)); } return(true); }
public float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) { float baseExpertise = 7.5f; switch (attType) { case WeaponAttackType.BaseAttack: return(baseExpertise + GetUInt32Value(PlayerFields.Expertise) / 4.0f); case WeaponAttackType.OffAttack: return(baseExpertise + GetUInt32Value(PlayerFields.OffhandExpertise) / 4.0f); default: break; } return(0.0f); }
public float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) { float baseExpertise = 7.5f; switch (attType) { case WeaponAttackType.BaseAttack: return(baseExpertise + m_activePlayerData.MainhandExpertise / 4.0f); case WeaponAttackType.OffAttack: return(baseExpertise + m_activePlayerData.OffhandExpertise / 4.0f); default: break; } return(0.0f); }
public void _ApplyWeaponDamage(uint slot, Item item, bool apply) { ItemTemplate proto = item.GetTemplate(); WeaponAttackType attType = WeaponAttackType.BaseAttack; float damage = 0.0f; if (slot == EquipmentSlot.MainHand && (proto.GetInventoryType() == InventoryType.Ranged || proto.GetInventoryType() == InventoryType.RangedRight)) { attType = WeaponAttackType.RangedAttack; } else if (slot == EquipmentSlot.OffHand) { attType = WeaponAttackType.OffAttack; } float minDamage, maxDamage; item.GetDamage(this, out minDamage, out maxDamage); if (minDamage > 0) { damage = apply ? minDamage : SharedConst.BaseMinDamage; SetBaseWeaponDamage(attType, WeaponDamageRange.MinDamage, damage); } if (maxDamage > 0) { damage = apply ? maxDamage : SharedConst.BaseMaxDamage; SetBaseWeaponDamage(attType, WeaponDamageRange.MaxDamage, damage); } SpellShapeshiftFormRecord shapeshift = CliDB.SpellShapeshiftFormStorage.LookupByKey(GetShapeshiftForm()); if (proto.GetDelay() != 0 && !(shapeshift != null && shapeshift.CombatRoundTime != 0)) { SetBaseAttackTime(attType, apply ? proto.GetDelay() : SharedConst.BaseAttackTime); } if (CanModifyStats() && (damage != 0 || proto.GetDelay() != 0)) { UpdateDamagePhysical(attType); } }
void SetRegularAttackTime() { for (WeaponAttackType weaponAttackType = 0; weaponAttackType < WeaponAttackType.Max; ++weaponAttackType) { Item tmpitem = GetWeaponForAttack(weaponAttackType, true); if (tmpitem != null && !tmpitem.IsBroken()) { ItemTemplate proto = tmpitem.GetTemplate(); if (proto.GetDelay() != 0) { SetBaseAttackTime(weaponAttackType, proto.GetDelay()); } } else { SetBaseAttackTime(weaponAttackType, SharedConst.BaseAttackTime); // If there is no weapon reset attack time to base (might have been changed from forms) } } }
/// <summary> /// 执行攻击逻辑 /// </summary> /// <param name="fsm"></param> private void Attack(IFsm <Hero> fsm) { WeaponAttackType attackType = (WeaponAttackType)fsm.GetData <VarInt> ("AttackType").Value; switch (attackType) { case WeaponAttackType.手动触发: ManualAttack(fsm); break; case WeaponAttackType.自动触发: break; case WeaponAttackType.技能触发: int weaponID = fsm.GetData <VarInt> ("WeaponID").Value; SkillAttack(fsm, attackType, weaponID); break; } }
public Weapon(string name, WeaponBaseType weaponBaseType, WeaponSubType weaponSubType, WeaponProficiencyType weaponProficiencyType, WeaponEffortType weaponEffortType, int[] mediumDamageRoll, WeaponAttackType weaponAttackType, int criticalMinRoll, int criticalMultiplier, WeaponDamageType[] weaponDamageTypes, int range, SizeType sizeType, double cost, double weight, string description) : base(name, cost, weight, description, slotType: SlotType.Weapon) { WeaponBaseType = weaponBaseType; WeaponSubType = weaponSubType; WeaponProficiencyType = weaponProficiencyType; WeaponEffortType = weaponEffortType; MediumDamageRoll = mediumDamageRoll; WeaponAttackType = weaponAttackType; CriticalMinRoll = criticalMinRoll; CriticalMultiplier = criticalMultiplier; WeaponDamageTypes = weaponDamageTypes; Range = range; SetSize(sizeType); // standard attack CombatActions.Add(CombatAction.CreateWeaponAttack(null, this, false)); // full attack CombatActions.Add(CombatAction.CreateWeaponAttack(null, this, true)); }
public DamageInfo(SpellNonMeleeDamage spellNonMeleeDamage, DamageEffectType damageType, WeaponAttackType attackType) { m_attacker = spellNonMeleeDamage.attacker; m_victim = spellNonMeleeDamage.target; m_damage = spellNonMeleeDamage.damage; m_spellInfo = Global.SpellMgr.GetSpellInfo(spellNonMeleeDamage.SpellId); m_schoolMask = spellNonMeleeDamage.schoolMask; m_damageType = damageType; m_attackType = attackType; m_absorb = spellNonMeleeDamage.absorb; m_resist = spellNonMeleeDamage.resist; m_block = spellNonMeleeDamage.blocked; if (spellNonMeleeDamage.blocked != 0) { m_hitMask |= ProcFlagsHit.Block; } if (spellNonMeleeDamage.absorb != 0) { m_hitMask |= ProcFlagsHit.Absorb; } }
public override void UpdateDamagePhysical(WeaponAttackType attType) { }
public Dictionary <int, KeyValuePair <AttributeCode, float> > ForgingAttributes; // 锻造附加属性 /// <summary> /// 类型:方法 /// 名称:Weapon /// 作者:taixihuase /// 作用:通过数据库中获得的数据构造武器装备实例 /// 编写日期:2015/8/16 /// </summary> /// <param name="fixedId"></param> /// <param name="allocatedId"></param> /// <param name="name"></param> /// <param name="occupation"></param> /// <param name="limit"></param> /// <param name="upgrade"></param> /// <param name="cur"></param> /// <param name="dur"></param> /// <param name="elem"></param> /// <param name="distance"></param> /// <param name="type"></param> /// <param name="weaponAttackType"></param> /// <param name="weaponElement"></param> /// <param name="speed"></param> public Weapon(int fixedId, int allocatedId, string name, OccupationCode occupation, int limit, bool upgrade, int cur, int dur, int elem, float speed, float distance, WeaponType type, WeaponAttackType weaponAttackType, WeaponElementType weaponElement) : base(fixedId, allocatedId, name, occupation, limit, upgrade, cur, dur, EquipmentType.Weapon) { Type = type; #region 武器属性初始化 WeaponAttack = weaponAttackType; if (weaponAttackType == WeaponAttackType.Both) { AttackLimit = new Dictionary <WeaponAttackType, KeyValuePair <int, int> >(new EnumComparer <WeaponAttackType>()) { [WeaponAttackType.Magic] = new KeyValuePair <int, int>(0, 0), [WeaponAttackType.Physical] = new KeyValuePair <int, int>(0, 0) }; } else { AttackLimit = new Dictionary <WeaponAttackType, KeyValuePair <int, int> >(new EnumComparer <WeaponAttackType>()) { [weaponAttackType] = new KeyValuePair <int, int>(0, 0) }; } #endregion ForgingAttributes = new Dictionary <int, KeyValuePair <AttributeCode, float> > { { -1, new KeyValuePair <AttributeCode, float>(AttributeCode.Null, 0) } }; FixedAttackSpeed = speed; FixedAttackDistance = distance; #region 武器元素初始化 WeaponElement = weaponElement; CurrentElementEnergy = elem; if (weaponElement != WeaponElementType.Null) { ElementAttributes = new KeyValuePair <WeaponElementType, Dictionary <AttributeCode, float> >(weaponElement, new Dictionary <AttributeCode, float>(new EnumComparer <AttributeCode>()) { { (AttributeCode)Enum.Parse(typeof(AttributeCode), "Enhance_" + weaponElement), 0 } }); int num = Convert.ToInt32(Enum.Parse(typeof(WeaponElementType), weaponElement.ToString())); int mul = 0; while ((num += mul * DataConstraint.ElementMaxSize) <= Enum.GetValues(typeof(ElementExtraAttribute)).Length) { var s = Enum.GetName(typeof(ElementExtraAttribute), num); if (s != null) { ElementAttributes.Value.Add((AttributeCode)Enum.Parse(typeof(AttributeCode), s), 0); } mul++; } } else { ElementAttributes = new KeyValuePair <WeaponElementType, Dictionary <AttributeCode, float> >(WeaponElementType.Null, new Dictionary <AttributeCode, float>(new EnumComparer <AttributeCode>()) { { AttributeCode.Null, 0 } }); } #endregion }
void GetWeaponAttributes(AttackTypes type) { weaponAttackType = weaponAttributes.weaponAttackType; weaponImpactClip = weaponAttributes.impactClip; shellPrefab = weaponAttributes.shellPrefab; shellSpeed = weaponAttributes.shellSpeed; shellFlyTime = weaponAttributes.shellFlyTime; float _delayMultiplier = movement.isOnGround ? 1f : 1.5f; switch (type) { case AttackTypes.Light: damage = weaponAttributes.lightAttackDamage; staminaCosts = weaponAttributes.lightAttackStaminaCosts; weaponElement = weaponAttributes.elements[type]; weaponDamageType = weaponAttributes.damageTypesOfAttacks[type]; //fix it attackForceDistance = weaponAttributes.lightAttackForce; //If the stamina enough to attack - multiply = 1 else = 2 //anim.speed = attributes.Stamina >= staminaCosts ? anim.speed : anim.speed / 2f; timeBtwAttacks = weaponAttributes.lightAttackSpeed / attributes.AnimSpeed + Time.time; attackDuration = weaponAttributes.lightAttackSpeed / attributes.AnimSpeed * _delayMultiplier + Time.time; weaponSwingClip = weaponAttributes.lightSwingClips.Length > 0 ? weaponAttributes.lightSwingClips[Random.Range(0, weaponAttributes.lightSwingClips.Length)] : null; weaponAudioClip = weaponAttributes.lightAttackClips[Random.Range(0, weaponAttributes.lightAttackClips.Length)]; break; case AttackTypes.Strong: damage = weaponAttributes.strongAttackDamage; staminaCosts = weaponAttributes.strongAttackStaminaCosts; weaponElement = weaponAttributes.elements[type]; weaponDamageType = weaponAttributes.damageTypesOfAttacks[type]; //fix it attackForceDistance = weaponAttributes.strongAttackForce; //If the stamina enough to attack - multiply = 1 else = 2 //anim.speed = attributes.Stamina >= staminaCosts ? anim.speed : anim.speed / 2f; timeBtwAttacks = (movement.isOnGround ? weaponAttributes.strongAttackSpeed : weaponAttributes.lightAttackSpeed) / attributes.AnimSpeed + Time.time; attackDuration = (movement.isOnGround ? weaponAttributes.strongAttackSpeed : weaponAttributes.lightAttackSpeed) / attributes.AnimSpeed * _delayMultiplier + Time.time; weaponSwingClip = weaponAttributes.strongSwingClips.Length > 0 ? weaponAttributes.strongSwingClips[Random.Range(0, weaponAttributes.strongSwingClips.Length)] : null; weaponAudioClip = weaponAttributes.strongAttackClips[Random.Range(0, weaponAttributes.strongAttackClips.Length)]; break; case AttackTypes.Joint: damage = weaponAttributes.jointAttackDamage; staminaCosts = weaponAttributes.jointAttackStaminaCosts; weaponElement = weaponAttributes.elements[type]; weaponDamageType = weaponAttributes.damageTypesOfAttacks[type]; //fix it attackForceDistance = weaponAttributes.jointAttackForce; //If the stamina enough to attack - multiply = 1 else = 2 //anim.speed = attributes.Stamina >= staminaCosts ? anim.speed : anim.speed / 2f; timeBtwAttacks = (movement.isOnGround ? weaponAttributes.jointAttackSpeed : weaponAttributes.lightAttackSpeed) / attributes.AnimSpeed + Time.time; attackDuration = (movement.isOnGround ? weaponAttributes.jointAttackSpeed : weaponAttributes.lightAttackSpeed) / attributes.AnimSpeed * _delayMultiplier + Time.time; weaponSwingClip = weaponAttributes.jointSwingClips.Length > 0 ? weaponAttributes.jointSwingClips[Random.Range(0, weaponAttributes.jointSwingClips.Length)] : null; weaponAudioClip = weaponAttributes.jointAttackClips[Random.Range(0, weaponAttributes.jointAttackClips.Length)]; break; case AttackTypes.TopDown: damage = weaponAttributes.topDownAttackDamage; //attributes.Stamina >= staminaCosts ? weaponAttributes.topDownAttackDamage : weaponAttributes.topDownAttackDamage / 10; staminaCosts = weaponAttributes.topDownAttackStaminaCosts; weaponElement = weaponAttributes.elements[type]; weaponDamageType = weaponAttributes.damageTypesOfAttacks[type]; //fix it attackForceDistance = weaponAttributes.topDownAttackForce; timeBtwAttacks = weaponAttributes.topDownAttackSpeed / attributes.AnimSpeed + Time.time; attackDuration = weaponAttributes.topDownAttackSpeed / attributes.AnimSpeed * _delayMultiplier + Time.time; break; } attributes.SetAnimationSpeed(attributes.defAnimSpeed / (timeBtwAttacks - Time.time)); if (weaponSwingClip != null) { AudioManager.PlaySwingAudio(weaponSwingClip); } }
public Dictionary<int, KeyValuePair<AttributeCode, float>> ForgingAttributes; // 锻造附加属性 #endregion Fields #region Constructors /// <summary> /// 类型:方法 /// 名称:Weapon /// 作者:taixihuase /// 作用:通过数据库中获得的数据构造武器装备实例 /// 编写日期:2015/8/16 /// </summary> /// <param name="fixedId"></param> /// <param name="allocatedId"></param> /// <param name="name"></param> /// <param name="occupation"></param> /// <param name="limit"></param> /// <param name="upgrade"></param> /// <param name="cur"></param> /// <param name="dur"></param> /// <param name="elem"></param> /// <param name="distance"></param> /// <param name="type"></param> /// <param name="weaponAttackType"></param> /// <param name="weaponElement"></param> /// <param name="speed"></param> public Weapon(int fixedId, int allocatedId, string name, OccupationCode occupation, int limit, bool upgrade, int cur, int dur, int elem, float speed, float distance, WeaponType type, WeaponAttackType weaponAttackType, WeaponElementType weaponElement) : base(fixedId, allocatedId, name, occupation, limit, upgrade, cur, dur, EquipmentType.Weapon) { Type = type; #region 武器属性初始化 WeaponAttack = weaponAttackType; if (weaponAttackType == WeaponAttackType.Both) { AttackLimit = new Dictionary<WeaponAttackType, KeyValuePair<int, int>>(new EnumComparer<WeaponAttackType>()) { [WeaponAttackType.Magic] = new KeyValuePair<int, int>(0, 0), [WeaponAttackType.Physical] = new KeyValuePair<int, int>(0, 0) }; } else { AttackLimit = new Dictionary<WeaponAttackType, KeyValuePair<int, int>>(new EnumComparer<WeaponAttackType>()) { [weaponAttackType] = new KeyValuePair<int, int>(0, 0) }; } #endregion ForgingAttributes = new Dictionary<int, KeyValuePair<AttributeCode, float>> { {-1, new KeyValuePair<AttributeCode, float>(AttributeCode.Null, 0)} }; FixedAttackSpeed = speed; FixedAttackDistance = distance; #region 武器元素初始化 WeaponElement = weaponElement; CurrentElementEnergy = elem; if (weaponElement != WeaponElementType.Null) { ElementAttributes = new KeyValuePair<WeaponElementType, Dictionary<AttributeCode, float>>(weaponElement, new Dictionary<AttributeCode, float>(new EnumComparer<AttributeCode>()) { {(AttributeCode) Enum.Parse(typeof (AttributeCode), "Enhance_" + weaponElement), 0} }); int num = Convert.ToInt32(Enum.Parse(typeof (WeaponElementType), weaponElement.ToString())); int mul = 0; while ((num += mul*DataConstraint.ElementMaxSize) <= Enum.GetValues(typeof (ElementExtraAttribute)).Length) { var s = Enum.GetName(typeof (ElementExtraAttribute), num); if (s != null) { ElementAttributes.Value.Add((AttributeCode) Enum.Parse(typeof (AttributeCode), s), 0); } mul++; } } else { ElementAttributes = new KeyValuePair<WeaponElementType, Dictionary<AttributeCode, float>>(WeaponElementType.Null, new Dictionary<AttributeCode, float>(new EnumComparer<AttributeCode>()) { {AttributeCode.Null, 0} }); } #endregion }
public override void UpdateDamagePhysical(WeaponAttackType attType) { if (attType > WeaponAttackType.BaseAttack) { return; } float bonusDamage = 0.0f; if (GetOwner().IsTypeId(TypeId.Player)) { //force of nature if (GetEntry() == ENTRY_TREANT) { int spellDmg = (int)((GetOwner().GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Nature)) + GetOwner().GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Nature)); if (spellDmg > 0) { bonusDamage = spellDmg * 0.09f; } } //greater fire elemental else if (GetEntry() == ENTRY_FIRE_ELEMENTAL) { int spellDmg = (int)((GetOwner().GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire)) + GetOwner().GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire)); if (spellDmg > 0) { bonusDamage = spellDmg * 0.4f; } } } UnitMods unitMod = UnitMods.DamageMainHand; float att_speed = GetBaseAttackTime(WeaponAttackType.BaseAttack) / 1000.0f; float base_value = GetModifierValue(unitMod, UnitModifierType.BaseValue) + GetTotalAttackPowerValue(attType) / 3.5f * att_speed + bonusDamage; float base_pct = GetModifierValue(unitMod, UnitModifierType.BasePCT); float total_value = GetModifierValue(unitMod, UnitModifierType.TotalValue); float total_pct = GetModifierValue(unitMod, UnitModifierType.TotalPCT); float weapon_mindamage = GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MinDamage); float weapon_maxdamage = GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MaxDamage); float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct; float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct; var mDummy = GetAuraEffectsByType(AuraType.ModAttackspeed); foreach (var eff in mDummy) { switch (eff.GetSpellInfo().Id) { case 61682: case 61683: MathFunctions.AddPct(ref mindamage, -eff.GetAmount()); MathFunctions.AddPct(ref maxdamage, -eff.GetAmount()); break; default: break; } } SetStatFloatValue(UnitFields.MinDamage, mindamage); SetStatFloatValue(UnitFields.MaxDamage, maxdamage); }
/// <summary> /// 技能攻击 /// </summary> /// <param name="fsm"></param> /// <param name="weaponID"></param> private void SkillAttack(IFsm <Hero> fsm, WeaponAttackType attackType, int weaponID) { fsm.Owner.FireWeapon(attackType, weaponID); }