public TempEnemy() : base() { type = 5; attackModifier = new AttackModifier(30); actionCds[0] = 1f; }
public static void SetToolTips(CombatHUDWeaponSlot slot, Dictionary <string, Func <AttackModifier> > factors) { try { AttackPos = ActiveState.PreviewPos; tip = slot.ToolTipHoverElement; thisModifier = "(Init)"; int TotalModifiers = 0; foreach (var modifier in factors) { thisModifier = modifier.Key; AttackModifier mod = modifier.Value(); TotalModifiers += AddToolTipDetail(mod); } if (TotalModifiers < 0 && !CombatConstants.ResolutionConstants.AllowTotalNegativeModifier) { TotalModifiers = 0; } tip.BasicModifierInt = Settings.ReverseInCombatModifier ? -TotalModifiers : TotalModifiers; } catch (Exception) { // Reset before giving up tip?.DebuffStrings.Clear(); tip?.BuffStrings.Clear(); throw; } }
public void CreateModifierInstance() { switch (Type) { case EffectType.AddDamage: Modifier = new NormalDamage((int)Amount); break; case EffectType.KnockBack: Modifier = new KnockBack(Amount); break; case EffectType.MoveFaster: Modifier = new MoveFaster(Amount); break; case EffectType.MoveSlower: Modifier = new MoveSlower(Amount); break; case EffectType.UpsideDown: Modifier = new UpsideDown((int)Amount); break; case EffectType.Fear: Modifier = new Fear((int)Amount); break; case EffectType.AddEffect: Modifier = new AddEffect((int)Amount); break; case EffectType.Grey: Modifier = new Grey((int)Amount); break; case EffectType.Chroma: Modifier = new Chroma((int)Amount); break; default: break; } }
public TestWeapon() { Modifier m = new AttackModifier(5); modifiers = new ModifierCollection(); modifiers.add(m); damgeMin = 20; damgeMax = 30; }
public void didAttackDidDamgeWithModifier() { AttackModifier atkmod = new AttackModifier(2); atk.mods.add(atkmod); atk.use(doer, targets, new TestRoller()); Assert.AreEqual(71, getter.currentHp); }
AttackModifier GetAttackModifier(CFGData cfg, EnemyGroups group) { AttackModifier result = AttackModifier.Normal; switch (group) { case EnemyGroups.Undead: if (HasFlags(cfg.AttackModifierFlags, 0x01)) { result = AttackModifier.Bonus; } else if (HasFlags(cfg.AttackModifierFlags, 0x10)) { result = AttackModifier.Phobia; } break; case EnemyGroups.Daedra: if (HasFlags(cfg.AttackModifierFlags, 0x02)) { result = AttackModifier.Bonus; } else if (HasFlags(cfg.AttackModifierFlags, 0x20)) { result = AttackModifier.Phobia; } break; case EnemyGroups.Humanoid: if (HasFlags(cfg.AttackModifierFlags, 0x04)) { result = AttackModifier.Bonus; } else if (HasFlags(cfg.AttackModifierFlags, 0x40)) { result = AttackModifier.Phobia; } break; case EnemyGroups.Animals: if (HasFlags(cfg.AttackModifierFlags, 0x08)) { result = AttackModifier.Bonus; } else if (HasFlags(cfg.AttackModifierFlags, 0x80)) { result = AttackModifier.Phobia; } break; } return(result); }
public bool loadSkills() { if (SaveLoad.Load()) { SkillTree tree = GameSave.current.skilltree; Skill[] skills = tree.skills; if (skills[0] != null) { attackModifier = new AttackModifier(skills[0].skillType); } else { attackModifier = new AttackModifier(3); } if (skills[1] != null) { chargedAttackModifier = new ChargedAttackModifier(skills[1].skillType); } else { chargedAttackModifier = new ChargedAttackModifier(103); } if (skills[2] != null) { dodgeModifier = new DodgeModifier(skills[2].skillType); } else { dodgeModifier = new DodgeModifier(150); } if (skills[3] != null) { blockModifier = new BlockModifier(skills[3].skillType); } else { blockModifier = new BlockModifier(200); } activeSkills = new ArrayList(); if (skills[4] != null) { activeSkills.Add(new ActiveModifier(skills[4].skillType)); } if (skills[6] != null) { activeSkills.Add(new ActiveModifier(skills[6].skillType)); } return(true); } return(false); }
public override string ToString() { string weaponString = base.ToString() + ", "; weaponString += NumberHands.ToString() + ", "; weaponString += AttackValue.ToString() + ", "; weaponString += AttackModifier.ToString() + ", "; weaponString += DamageEffect.ToString(); foreach (string s in AllowableClasses) { weaponString += ", " + s; } return(weaponString); }
public override string ToString() { string weapString = base.ToString() + ", "; weapString += NumberHands.ToString() + ", "; weapString += AttackValue.ToString() + ", "; weapString += AttackModifier.ToString() + ", "; weapString += DamageValue.ToString() + ", "; weapString += DamageModifier.ToString() + ", "; foreach (Type t in allowableClasses) { weapString += ", " + t.Name; } return(base.ToString()); }
public static float SumModifiers(Dictionary <string, Func <AttackModifier> > factors) { thisModifier = "(Init)"; int TotalModifiers = 0; foreach (var modifier in factors) { thisModifier = modifier.Key; AttackModifier mod = modifier.Value(); TotalModifiers += Mathf.RoundToInt(mod.Value); } if (TotalModifiers < 0 && !CombatConstants.ResolutionConstants.AllowTotalNegativeModifier) { return(0); } return(TotalModifiers); }
public MainCharacter() : base() { actionCds[2] = 3f; actionCds[3] = 1.5f; actionCds[4] = 5f; actionCds[5] = 5f; status.regularMoveSpeed = 40f; if(!loadSkills()) { attackModifier = new AttackModifier(3); dodgeModifier = new DodgeModifier(150); chargedAttackModifier = new ChargedAttackModifier(103); blockModifier = new BlockModifier(200); activeSkills = new ArrayList(); //activeSkills.Add(new ActiveModifier(251)); //activeSkills.Add(new ActiveModifier(258)); } div = MainCharacterDiv.Division; }
private static int AddToolTipDetail(AttackModifier tooltip) { int mod = Mathf.RoundToInt(tooltip.Value); if (mod == 0) { return(0); } List <Text> TipList = mod > 0 ? tip.DebuffStrings : tip.BuffStrings; if (Settings.ReverseInCombatModifier) { mod = -mod; } string numTxt = (mod > 0 ? " +" : " ") + mod; TipList.Add(new Text(tooltip.DisplayName + numTxt)); return(Settings.ReverseInCombatModifier ? -mod : mod); }
public bool loadSkills() { if(SaveLoad.Load()) { SkillTree tree = GameSave.current.skilltree; Skill[] skills = tree.skills; if(skills[0]!=null)attackModifier = new AttackModifier(skills[0].skillType); else attackModifier = new AttackModifier(3); if(skills[1]!=null)chargedAttackModifier = new ChargedAttackModifier(skills[1].skillType); else chargedAttackModifier = new ChargedAttackModifier(103); if(skills[2]!=null)dodgeModifier = new DodgeModifier(skills[2].skillType); else dodgeModifier = new DodgeModifier(150); if(skills[3]!=null)blockModifier = new BlockModifier(skills[3].skillType); else blockModifier = new BlockModifier(200); activeSkills = new ArrayList(); if(skills[4]!=null)activeSkills.Add(new ActiveModifier(skills[4].skillType)); if(skills[6]!=null)activeSkills.Add(new ActiveModifier(skills[6].skillType)); return true; } return false; }
void Start() { type = 9; status.maxhp = 4500; status.hp = 4500; status.canBeCCed = false; actionCds[0] = 6f; //Single Ram actionCds[1] = 20f; //Divide actionCdRemain[0] = 2f; actionCdRemain[1] = 5f; actionCds[2] = 12f; actionCds[3] = 3f; attackModifier = new AttackModifier(31); chargedAttackModifier = new ChargedAttackModifier(117); lowerShields = new ArrayList(); for (int a = 0; a != 8; ++a) { float angle = a * 360f / 8f * Mathf.Deg2Rad + lowerAnglePlus; Vector3 pos = new Vector3(Mathf.Sin(angle) * lowerRadius, -0.03f, Mathf.Cos(angle) * lowerRadius); Quaternion rot = Quaternion.Euler(new Vector3(270f, 45f * a, 0f)); GameObject obj = (GameObject)Instantiate(Resources.Load("Prefabs/Boss1/lowerShield"), pos, rot); obj.transform.parent = this.gameObject.transform; obj.transform.localScale = new Vector3(90f, 90f, 90f); obj.transform.localPosition = pos; lowerShields.Add(obj); } upperShields = new ArrayList(); for (int a = 0; a != 8; ++a) { float angle = a * 360f / 8f * Mathf.Deg2Rad + upperAnglePlus; Vector3 pos = new Vector3(Mathf.Sin(angle) * upperRadius, 0.514f, Mathf.Cos(angle) * upperRadius); Quaternion rot = Quaternion.Euler(new Vector3(270f, 45f * a, 0f)); GameObject obj = (GameObject)Instantiate(Resources.Load("Prefabs/Boss1/upperShield"), pos, rot); obj.transform.parent = this.gameObject.transform; obj.transform.localScale = new Vector3(90f, 90f, 90f); obj.transform.localPosition = pos; upperShields.Add(obj); } }
public MainCharacter() : base() { actionCds[2] = 3f; actionCds[3] = 1.5f; actionCds[4] = 5f; actionCds[5] = 5f; status.regularMoveSpeed = 40f; if (!loadSkills()) { attackModifier = new AttackModifier(3); dodgeModifier = new DodgeModifier(150); chargedAttackModifier = new ChargedAttackModifier(103); blockModifier = new BlockModifier(200); activeSkills = new ArrayList(); //activeSkills.Add(new ActiveModifier(251)); //activeSkills.Add(new ActiveModifier(258)); } div = MainCharacterDiv.Division; }
void Start () { type = 9; status.maxhp = 4500; status.hp = 4500; status.canBeCCed = false; actionCds[0] = 6f; //Single Ram actionCds[1] = 20f; //Divide actionCdRemain[0] = 2f; actionCdRemain[1] = 5f; actionCds[2] = 12f; actionCds[3] = 3f; attackModifier = new AttackModifier(31); chargedAttackModifier = new ChargedAttackModifier(117); lowerShields = new ArrayList(); for(int a=0;a!=8;++a) { float angle = a * 360f/8f*Mathf.Deg2Rad + lowerAnglePlus; Vector3 pos = new Vector3(Mathf.Sin(angle)*lowerRadius, -0.03f, Mathf.Cos(angle)*lowerRadius); Quaternion rot = Quaternion.Euler(new Vector3(270f, 45f*a, 0f)); GameObject obj = (GameObject)Instantiate(Resources.Load("Prefabs/Boss1/lowerShield"), pos, rot); obj.transform.parent = this.gameObject.transform; obj.transform.localScale = new Vector3(90f, 90f, 90f); obj.transform.localPosition = pos; lowerShields.Add(obj); } upperShields = new ArrayList(); for(int a=0;a!=8;++a) { float angle = a * 360f/8f*Mathf.Deg2Rad + upperAnglePlus; Vector3 pos = new Vector3(Mathf.Sin(angle)*upperRadius, 0.514f, Mathf.Cos(angle)*upperRadius); Quaternion rot = Quaternion.Euler(new Vector3(270f, 45f*a, 0f)); GameObject obj = (GameObject)Instantiate(Resources.Load("Prefabs/Boss1/upperShield"), pos, rot); obj.transform.parent = this.gameObject.transform; obj.transform.localScale = new Vector3(90f, 90f, 90f); obj.transform.localPosition = pos; upperShields.Add(obj); } }
public override void OnHit(Mobile defender, ref int damage) { int mana = ScaleMana(GetMana()); if (Caster.Mana < mana) { Expire(); return; } Caster.Mana -= mana; if (Target != defender) { AttackModifier = GetMasteryLevel() * 6; DefenseModifier = GetMasteryLevel() * 6; Target = defender; BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.ThrustDebuff, 1155989, BuffInfo.Blank, "")); Server.Timer.DelayCall(TimeSpan.FromSeconds(8), () => { Reset(); }); } else { AttackModifier = Math.Min(MaxAttack, AttackModifier + (GetMasteryLevel() * 6)); DefenseModifier = Math.Min(MaxDefense, DefenseModifier + (GetMasteryLevel() * 6)); } BuffInfo.RemoveBuff(Caster, BuffIcon.Thrust); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Thrust, 1155989, 1155990, String.Format("{0}\t{1}\t{2}", AttackModifier.ToString(), DefenseModifier.ToString(), ScaleMana(30).ToString()))); //Your next physical attack will be increased by +~1_VAL~% damage while reducing your victim's physical attack damage by ~2_VAL~%.<br>Mana Upkeep Cost: ~3_VAL~. damage = (int)((double)damage + ((double)damage * ((double)DefenseModifier / 100.0))); defender.FixedEffect(0x36BD, 20, 10, 2725, 5); }
/// <summary> /// Reads RawData into structured data. /// </summary> public void StructureData(CFGData cfg) { this.Name = cfg.Name; this.Strength = cfg.Attributes[0]; this.Intelligence = cfg.Attributes[1]; this.Willpower = cfg.Attributes[2]; this.Agility = cfg.Attributes[3]; this.Endurance = cfg.Attributes[4]; this.Personality = cfg.Attributes[5]; this.Speed = cfg.Attributes[6]; this.Luck = cfg.Attributes[7]; this.PrimarySkill1 = (Skills)cfg.PrimarySkill1; this.PrimarySkill2 = (Skills)cfg.PrimarySkill2; this.PrimarySkill3 = (Skills)cfg.PrimarySkill3; this.MajorSkill1 = (Skills)cfg.MajorSkill1; this.MajorSkill2 = (Skills)cfg.MajorSkill2; this.MajorSkill3 = (Skills)cfg.MajorSkill3; this.MinorSkill1 = (Skills)cfg.MinorSkill1; this.MinorSkill2 = (Skills)cfg.MinorSkill2; this.MinorSkill3 = (Skills)cfg.MinorSkill3; this.MinorSkill4 = (Skills)cfg.MinorSkill4; this.MinorSkill5 = (Skills)cfg.MinorSkill5; this.MinorSkill6 = (Skills)cfg.MinorSkill6; this.HitPointsPerLevel = cfg.HitPointsPerLevel; float value = (cfg.AdvancementMultiplier >> 16) + ((cfg.AdvancementMultiplier & 0xffff)) / 65536f; try { this.AdvancementMultiplier = float.Parse(string.Format("{0:0.00}", value), NumberStyles.Float, CultureInfo.InvariantCulture); } catch { this.AdvancementMultiplier = value; } this.Paralysis = GetTolerance(cfg, EffectFlags.Paralysis); this.Magic = GetTolerance(cfg, EffectFlags.Magic); this.Poison = GetTolerance(cfg, EffectFlags.Poison); this.Fire = GetTolerance(cfg, EffectFlags.Fire); this.Frost = GetTolerance(cfg, EffectFlags.Frost); this.Shock = GetTolerance(cfg, EffectFlags.Shock); this.Disease = GetTolerance(cfg, EffectFlags.Disease); this.ForbiddenMaterials = (MaterialFlags)cfg.ForbiddenMaterialsFlags; this.ForbiddenShields = (ShieldFlags)((cfg.WeaponArmorShieldsBitfield >> 9) & 0x0f); this.ForbiddenArmors = (ArmorFlags)((cfg.WeaponArmorShieldsBitfield >> 6) & 0x07); this.ForbiddenProficiencies = (ProficiencyFlags)(cfg.WeaponArmorShieldsBitfield & 0x3f); this.ExpertProficiencies = (ProficiencyFlags)((cfg.WeaponArmorShieldsBitfield >> 16) & 0x3f); this.ShortBlades = GetProficiency(ProficiencyFlags.ShortBlades); this.LongBlades = GetProficiency(ProficiencyFlags.LongBlades); this.HandToHand = GetProficiency(ProficiencyFlags.HandToHand); this.Axes = GetProficiency(ProficiencyFlags.Axes); this.BluntWeapons = GetProficiency(ProficiencyFlags.BluntWeapons); this.MissileWeapons = GetProficiency(ProficiencyFlags.MissileWeapons); this.SpellPointMultiplier = GetSpellPointMultiplier(cfg); this.SpellPointMultiplierValue = GetSpellPointMultiplierValue(this.SpellPointMultiplier); this.DarknessPoweredMagery = (DarknessMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x300) >> 8); this.LightPoweredMagery = (LightMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x00C0) >> 6); this.SpellAbsorption = (SpellAbsorptionFlags)cfg.SpellAbsorptionFlags; this.NoRegenSpellPoints = HasSpecialAbility(cfg, SpecialAbilityFlags.NoRegenSpellPoints); this.AcuteHearing = HasSpecialAbility(cfg, SpecialAbilityFlags.AcuteHearing); this.Athleticism = HasSpecialAbility(cfg, SpecialAbilityFlags.Athleticism); this.AdrenalineRush = HasSpecialAbility(cfg, SpecialAbilityFlags.AdrenalineRush); this.Regeneration = (RegenerationFlags)cfg.Regeneration; this.RapidHealing = (RapidHealingFlags)cfg.RapidHealing; this.DamageFromSunlight = HasSpecialAbility(cfg, SpecialAbilityFlags.SunDamage); this.DamageFromHolyPlaces = HasSpecialAbility(cfg, SpecialAbilityFlags.HolyDamage); this.UndeadAttackModifier = GetAttackModifier(cfg, EnemyGroups.Undead); this.DaedraAttackModifier = GetAttackModifier(cfg, EnemyGroups.Daedra); this.HumanoidAttackModifier = GetAttackModifier(cfg, EnemyGroups.Humanoid); this.AnimalsAttackModifier = GetAttackModifier(cfg, EnemyGroups.Animals); }
public override void OnCast() { if (!CheckSequence()) { return; } Phase = 1; DefenseModifier = GetMasteryLevel() * 6; Caster.PlaySound(0x101); Caster.FixedEffect(0x37C4, 0x1, 0x8, 0x4EB, 0); Caster.PrivateOverheadMessage(MessageType.Regular, 1150, 1155988, Caster.NetState); // *You enter a thrusting stance!* BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Thrust, 1155989, 1155990, String.Format("{0}\t{1}\t{2}", AttackModifier.ToString(), DefenseModifier.ToString(), ScaleMana(30).ToString()))); //Your next physical attack will be increased by +~1_VAL~% damage while reducing your victim's physical attack damage by ~2_VAL~%.<br>Mana Upkeep Cost: ~3_VAL~. FinishSequence(); BeginTimer(); }
private void Reset() { DefenseModifier = 0; Target = null; BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Thrust, 1155989, 1155990, String.Format("{0}\t{1}\t{2}", AttackModifier.ToString(), (GetMasteryLevel() * 6).ToString(), ScaleMana(30).ToString()))); //Your next physical attack will be increased by +~1_VAL~% damage while reducing your victim's physical attack damage by ~2_VAL~%.<br>Mana Upkeep Cost: ~3_VAL~. if (Target != null) { BuffInfo.RemoveBuff(Target, BuffIcon.ThrustDebuff); } }
public override void OnHit(Mobile defender, ref int damage) { int currentMod = AttackModifier; if (Target != defender) { Phase = 1; DefenseModifier = (GetMasteryLevel() * 6); Target = defender; new InternalTimer(this, defender); } else { DefenseModifier += (GetMasteryLevel() * 6); Phase++; } damage = (int)(damage + (damage * (currentMod / 100.0))); defender.FixedEffect(0x36BD, 0x1, 0xE, 0x776, 0); BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.ThrustDebuff, 1155989, 1156234, TimeSpan.FromSeconds(8), defender, DefenseModifier.ToString())); // All damage from your physical attacks have been reduced by ~1_val~%. BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Thrust, 1155989, 1155990, String.Format("{0}\t{1}\t{2}", AttackModifier.ToString(), (GetMasteryLevel() * 6).ToString(), ScaleMana(30).ToString()))); //Your next physical attack will be increased by +~1_VAL~% damage while reducing your victim's physical attack damage by ~2_VAL~%.<br>Mana Upkeep Cost: ~3_VAL~. if (!CheckMana()) { Reset(); Expire(); } }
public static Func <AttackModifier> GetRangedModifierFactor(string factorId) { switch (factorId) { case "armmounted": return(() => new AttackModifier("ARM MOUNTED", Hit.GetSelfArmMountedModifier(AttackWeapon))); case "range": // Depended by ShowNeutralRangeInBreakdown return(() => { Weapon w = AttackWeapon; float range = Vector3.Distance(AttackPos, TargetPos), modifier = Hit.GetRangeModifierForDist(w, range); AttackModifier result = new AttackModifier(modifier); if (range < w.MinRange) { return result.SetName($"MIN RANGE (<{(int)w.MinRange}m)"); } if (range < w.ShortRange) { return result.SetName("SHORT RANGE" + SmartRange(w.MinRange, range, w.ShortRange)); } if (range < w.MediumRange) { return result.SetName("MED RANGE" + SmartRange(w.ShortRange, range, w.MediumRange)); } if (range < w.LongRange) { return result.SetName("LONG RANGE" + SmartRange(w.MediumRange, range, w.LongRange)); } if (range < w.MaxRange) { return result.SetName("MAX RANGE" + SmartRange(w.LongRange, range, w.MaxRange)); } return result.SetName($"OUT OF RANGE (>{(int)w.MaxRange}m)"); }); case "height": return(() => new AttackModifier("HEIGHT", Hit.GetHeightModifier(AttackPos.y, TargetPos.y))); case "indirect": return(() => new AttackModifier("INDIRECT FIRE", Hit.GetIndirectModifier(Attacker, LineOfFire < LineOfFireLevel.LOFObstructed && AttackWeapon.IndirectFireCapable))); case "locationdamage": return(() => { if (Attacker is Mech mech) { Text location = Mech.GetAbbreviatedChassisLocation((ChassisLocations)AttackWeapon.Location); return new AttackModifier($"{location} DAMAGED", MechStructureRules.GetToHitModifierLocationDamage(mech, AttackWeapon)); } else { return new AttackModifier("CHASSIS DAMAGED", Hit.GetSelfDamageModifier(Attacker, AttackWeapon)); } }); case "obstruction": return(() => new AttackModifier("OBSTRUCTED", Hit.GetCoverModifier(Attacker, Target, LineOfFire))); case "precision": return(() => new AttackModifier(CombatConstants.CombatUIConstants.MoraleAttackDescription.Name, Hit.GetMoraleAttackModifier(Target, IsMoraleAttack))); case "refire": return(() => new AttackModifier("RECOIL", Hit.GetRefireModifier(AttackWeapon))); case "targetevasion": return(() => new AttackModifier("TARGET MOVED", Hit.GetTargetSpeedModifier(Target, AttackWeapon))); case "targetprone": return(() => new AttackModifier("TARGET PRONE", Hit.GetTargetProneModifier(Target, false))); case "targetshutdown": return(() => new AttackModifier("TARGET SHUTDOWN", Hit.GetTargetShutdownModifier(Target, false))); case "sensorlock": return(() => new AttackModifier("SENSOR LOCK", Hit.GetTargetDirectFireModifier(Target, LineOfFire < LineOfFireLevel.LOFObstructed && AttackWeapon.IndirectFireCapable))); case "weapondamage": return(() => { AttackModifier result = new AttackModifier("WEAPON DAMAGED"); if (!(Attacker is Mech mech)) { return result; } return result.SetValue(MechStructureRules.GetToHitModifierWeaponDamage(mech, AttackWeapon)); }); } return(null); }
/// <summary> /// Reads RawData into structured data. /// </summary> public void StructureData(CFGData cfg) { this.Name = cfg.Name; this.Strength = cfg.Attributes[0]; this.Intelligence = cfg.Attributes[1]; this.Willpower = cfg.Attributes[2]; this.Agility = cfg.Attributes[3]; this.Endurance = cfg.Attributes[4]; this.Personality = cfg.Attributes[5]; this.Speed = cfg.Attributes[6]; this.Luck = cfg.Attributes[7]; this.PrimarySkill1 = (Skills)cfg.PrimarySkill1; this.PrimarySkill2 = (Skills)cfg.PrimarySkill2; this.PrimarySkill3 = (Skills)cfg.PrimarySkill3; this.MajorSkill1 = (Skills)cfg.MajorSkill1; this.MajorSkill2 = (Skills)cfg.MajorSkill2; this.MajorSkill3 = (Skills)cfg.MajorSkill3; this.MinorSkill1 = (Skills)cfg.MinorSkill1; this.MinorSkill2 = (Skills)cfg.MinorSkill2; this.MinorSkill3 = (Skills)cfg.MinorSkill3; this.MinorSkill4 = (Skills)cfg.MinorSkill4; this.MinorSkill5 = (Skills)cfg.MinorSkill5; this.MinorSkill6 = (Skills)cfg.MinorSkill6; this.HitPointsPerLevelOrMonsterLevel = cfg.HitPointsPerLevelOrMonsterLevel; float value = (cfg.AdvancementMultiplier >> 16) + ((cfg.AdvancementMultiplier & 0xffff)) / 65536f; try { this.AdvancementMultiplier = float.Parse(string.Format("{0:0.00}", value), NumberStyles.Float, CultureInfo.InvariantCulture); } catch { this.AdvancementMultiplier = value; } this.Paralysis = GetTolerance(cfg, EffectFlags.Paralysis); this.Magic = GetTolerance(cfg, EffectFlags.Magic); this.Poison = GetTolerance(cfg, EffectFlags.Poison); this.Fire = GetTolerance(cfg, EffectFlags.Fire); this.Frost = GetTolerance(cfg, EffectFlags.Frost); this.Shock = GetTolerance(cfg, EffectFlags.Shock); this.Disease = GetTolerance(cfg, EffectFlags.Disease); this.ForbiddenMaterials = (MaterialFlags)cfg.ForbiddenMaterialsFlags; this.ForbiddenShields = (ShieldFlags)((cfg.WeaponArmorShieldsBitfield >> 9) & 0x0f); this.ForbiddenArmors = (ArmorFlags)((cfg.WeaponArmorShieldsBitfield >> 6) & 0x07); this.ForbiddenProficiencies = (ProficiencyFlags)(cfg.WeaponArmorShieldsBitfield & 0x3f); this.ExpertProficiencies = (ProficiencyFlags)((cfg.WeaponArmorShieldsBitfield >> 16) & 0x3f); this.ShortBlades = GetProficiency(ProficiencyFlags.ShortBlades); this.LongBlades = GetProficiency(ProficiencyFlags.LongBlades); this.HandToHand = GetProficiency(ProficiencyFlags.HandToHand); this.Axes = GetProficiency(ProficiencyFlags.Axes); this.BluntWeapons = GetProficiency(ProficiencyFlags.BluntWeapons); this.MissileWeapons = GetProficiency(ProficiencyFlags.MissileWeapons); this.SpellPointMultiplier = GetSpellPointMultiplier(cfg); this.SpellPointMultiplierValue = GetSpellPointMultiplierValue(this.SpellPointMultiplier); this.DarknessPoweredMagery = (DarknessMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x300) >> 8); this.LightPoweredMagery = (LightMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x00C0) >> 6); this.SpellAbsorption = (SpellAbsorptionFlags)cfg.SpellAbsorptionFlags; this.NoRegenSpellPoints = HasSpecialAbility(cfg, SpecialAbilityFlags.NoRegenSpellPoints); this.AcuteHearing = HasSpecialAbility(cfg, SpecialAbilityFlags.AcuteHearing); this.Athleticism = HasSpecialAbility(cfg, SpecialAbilityFlags.Athleticism); this.AdrenalineRush = HasSpecialAbility(cfg, SpecialAbilityFlags.AdrenalineRush); this.Regeneration = (RegenerationFlags)cfg.Regeneration; this.RapidHealing = (RapidHealingFlags)cfg.RapidHealing; this.DamageFromSunlight = HasSpecialAbility(cfg, SpecialAbilityFlags.SunDamage); this.DamageFromHolyPlaces = HasSpecialAbility(cfg, SpecialAbilityFlags.HolyDamage); this.UndeadAttackModifier = GetAttackModifier(cfg, EnemyGroups.Undead); this.DaedraAttackModifier = GetAttackModifier(cfg, EnemyGroups.Daedra); this.HumanoidAttackModifier = GetAttackModifier(cfg, EnemyGroups.Humanoid); this.AnimalsAttackModifier = GetAttackModifier(cfg, EnemyGroups.Animals); }
public static Func <AttackModifier> GetMeleeModifierFactor(string factorId) { switch (factorId) { case "armmounted": return(() => { AttackModifier result = new AttackModifier("PUNCHING ARM"); if (AttackType == MeleeAttackType.DFA || Target is Vehicle || Target.IsProne || !(Attacker is Mech mech)) { return result; } if (mech.MechDef.Chassis.PunchesWithLeftArm) { if (mech.IsLocationDestroyed(ChassisLocations.LeftArm)) { return result; } } else if (mech.IsLocationDestroyed(ChassisLocations.RightArm)) { return result; } return result.SetValue(CombatConstants.ToHit.ToHitSelfArmMountedWeapon); }); case "dfa": return(() => new AttackModifier("DEATH FROM ABOVE", Hit.GetDFAModifier(AttackType))); case "height": return(() => { AttackModifier result = new AttackModifier("HEIGHT DIFF"); if (AttackType == MeleeAttackType.DFA) { return result.SetValue(Hit.GetHeightModifier(Attacker.CurrentPosition.y, Target.CurrentPosition.y)); } float diff = AttackPos.y - Target.CurrentPosition.y; if (Math.Abs(diff) < HalfMaxMeleeVerticalOffset || (diff < 0 && !CombatConstants.ToHit.ToHitElevationApplyPenalties)) { return result; } float mod = CombatConstants.ToHit.ToHitElevationModifierPerLevel; return result.SetValue(diff <= 0 ? mod : -mod); }); case "obstruction": return(() => new AttackModifier("OBSTRUCTED", Hit.GetCoverModifier(Attacker, Target, Combat.LOS.GetLineOfFire(Attacker, AttackPos, Target, TargetPos, Target.CurrentRotation, out Vector3 collision)))); case "refire": return(() => new AttackModifier("RE-ATTACK", Hit.GetRefireModifier(AttackWeapon))); case "selfchassis": return(() => new AttackModifier(Hit.GetMeleeChassisToHitModifier(Attacker, AttackType)).SetName("CHASSIS PENALTY", "CHASSIS BONUS")); case "targetevasion": return(() => { AttackModifier result = new AttackModifier("TARGET MOVED"); if (!(Target is AbstractActor actor)) { return result; } return result.SetValue(Hit.GetEvasivePipsModifier(actor.EvasivePipsCurrent, AttackWeapon)); }); case "targetprone": return(() => new AttackModifier("TARGET PRONE", Hit.GetTargetProneModifier(Target, true))); case "targetshutdown": return(() => new AttackModifier("TARGET SHUTDOWN", Hit.GetTargetShutdownModifier(Target, true))); } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="Attacker" /> class. /// </summary> /// <param name="unit"> /// The unit. /// </param> public Attacker(Unit unit) { Unit = unit; switch (unit.ClassId) { case ClassId.CDOTA_Unit_Hero_Clinkz: AttackModifier = unit.Spellbook.Spell2; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && unit.Mana > AttackModifier.ManaCost) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; case ClassId.CDOTA_Unit_Hero_DrowRanger: AttackModifier = unit.Spellbook.Spell1; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && unit.Mana > AttackModifier.ManaCost) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; case ClassId.CDOTA_Unit_Hero_Viper: AttackModifier = unit.Spellbook.SpellQ; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && unit.Mana > AttackModifier.ManaCost) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; case ClassId.CDOTA_Unit_Hero_Huskar: AttackModifier = unit.Spellbook.Spell2; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && Unit.Health > Unit.MaximumHealth * 0.35) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; case ClassId.CDOTA_Unit_Hero_Silencer: AttackModifier = unit.Spellbook.Spell2; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && Unit.Mana > AttackModifier.ManaCost) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; case ClassId.CDOTA_Unit_Hero_Jakiro: AttackModifier = unit.Spellbook.Spell3; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && AttackModifier.CanBeCasted()) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; case ClassId.CDOTA_Unit_Hero_Obsidian_Destroyer: AttackModifier = unit.Spellbook.Spell1; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && Unit.Mana > AttackModifier.ManaCost) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; case ClassId.CDOTA_Unit_Hero_Enchantress: AttackModifier = unit.Spellbook.Spell4; attack = (target) => { if (useModifier && Unit.CanCast() && AttackModifier.Level > 0 && Unit.Mana > AttackModifier.ManaCost) { AttackModifier.UseAbility(target); return; } Unit.Attack(target); }; break; default: attack = (target) => { if (target == null) { return; } Unit.Attack(target); }; break; } }