public ProficiencyBonus(int level, Proficiency proficiency) { Type = Bonustype.Proficiency.ToString("g"); Amount = proficiency != Proficiency.Untrained ? level + (int)proficiency : 0; }
/// <summary> /// Called when a player hits a target /// </summary> public override void OnDamageTarget(WorldObject target, AttackType attackType) { var attackSkill = GetCreatureSkill(GetCurrentWeaponSkill()); var difficulty = GetTargetEffectiveDefenseSkill(target); Proficiency.OnSuccessUse(this, attackSkill, difficulty); }
private void UpdatePistolProfEditElements() { PistolProfLevelSlider.Value = Model.Save.Proficiencies.Pistol.Level; PistolProfPointsSlider.Maximum = (Proficiency.PointsToLevel(Model.Save.Proficiencies.Pistol.Level + 1) - 1).Clamp(0, int.MaxValue); PistolProfPointsSlider.Value = Model.Save.Proficiencies.Pistol.Points; PistolProfTotalPointsSlider.Value = Model.Save.Proficiencies.Pistol.TotalPoints; }
public ActionResult DeleteConfirmed(int id) { Proficiency proficiency = ProficiencyDAO.Get(id); ProficiencyDAO.Remove(proficiency); return(RedirectToAction("Index")); }
private void UpdateSniperRifleProfEditElements() { SniperRifleProfLevelSlider.Value = Model.Save.Proficiencies.SniperRifle.Level; SniperRifleProfPointsSlider.Maximum = (Proficiency.PointsToLevel(Model.Save.Proficiencies.SniperRifle.Level + 1) - 1).Clamp(0, int.MaxValue); SniperRifleProfPointsSlider.Value = Model.Save.Proficiencies.SniperRifle.Points; SniperRifleProfTotalPointsSlider.Value = Model.Save.Proficiencies.SniperRifle.TotalPoints; }
private void UpdateEridianProfEditElements() { EridianProfLevelSlider.Value = Model.Save.Proficiencies.Eridian.Level; EridianProfPointsSlider.Maximum = (Proficiency.PointsToLevel(Model.Save.Proficiencies.Eridian.Level + 1) - 1).Clamp(0, int.MaxValue); EridianProfPointsSlider.Value = Model.Save.Proficiencies.Eridian.Points; EridianProfTotalPointsSlider.Value = Model.Save.Proficiencies.Eridian.TotalPoints; }
private void UpdateRocketLauncherProfEditElements() { RocketLauncherProfLevelSlider.Value = Model.Save.Proficiencies.RocketLauncher.Level; RocketLauncherProfPointsSlider.Maximum = (Proficiency.PointsToLevel(Model.Save.Proficiencies.RocketLauncher.Level + 1) - 1).Clamp(0, int.MaxValue); RocketLauncherProfPointsSlider.Value = Model.Save.Proficiencies.RocketLauncher.Points; RocketLauncherProfTotalPointsSlider.Value = Model.Save.Proficiencies.RocketLauncher.TotalPoints; }
public void AddExperience1() { Proficiency proficiency = new Proficiency(typeof(FireMagic), Proficiency.Rank.A); proficiency.AddExperience(101); LogAssert.Expect(LogType.Error, "Can't increase by more than 100: 101"); }
public bool CalculateManaUsage(CastingPreCheckStatus castingPreCheckStatus, Spell spell, WorldObject target, bool isWeaponSpell, out uint manaUsed) { manaUsed = 0; if (castingPreCheckStatus == CastingPreCheckStatus.Success) { manaUsed = CalculateManaUsage(this, spell, target); } else if (castingPreCheckStatus == CastingPreCheckStatus.CastFailed) { manaUsed = 5; // todo: verify with retail } var currentMana = Mana.Current; if (isWeaponSpell) { var caster = GetEquippedWand(); currentMana = (uint)(caster.ItemCurMana ?? 0); } if (manaUsed > currentMana) { SendUseDoneEvent(WeenieError.YouDontHaveEnoughManaToCast); return(false); } Proficiency.OnSuccessUse(this, GetCreatureSkill(Skill.ManaConversion), spell.PowerMod); return(true); }
private double CalculateBonus(Proficiency prof) { double modifier = 0; switch (prof) { case Proficiency.NotProficient: modifier = 0; break; case Proficiency.HalfProficient: modifier = 0.5; break; case Proficiency.Proficient: modifier = 1; break; case Proficiency.Expertise: modifier = 2; break; } return(Math.Floor(MainCharacteristic.Mod + (modifier * ProfBonus))); }
public InstrumentSkill(Instrument instrument, Proficiency proficiency, string background, ApplicationUser applicationUser) { ApplicationUser = applicationUser; Instrument = instrument; Proficiency = proficiency; BackgroundDescription = background; }
public Skill(Proficiency proficiency, int level, int modifierBonus, bool isDC = false, int itemBonus = 0, Armor armor = null) : base(proficiency, level, modifierBonus, isDC, itemBonus) { }
public void Awake() { prof = GetComponent<Proficiency>(); if (weaponHandLeft == null) Debug.LogError(gameObject.name + "'s left hand weapon transform has not been set!"); if (weaponHandRight == null) Debug.LogError(gameObject.name + "'s right hand weapon transform has not been set!"); }
public void LegendarTest() { int expected = 15; Proficiency proficiency = new Proficiency(Levels.legendary, this.level); int actual = proficiency.ProficiencyBonus(); Assert.AreEqual(expected, actual, 0.001, "Legendary Bonus not calculating correctly"); }
public void MasterTest() { int expected = 13; Proficiency proficiency = new Proficiency(Levels.master, this.level); int actual = proficiency.ProficiencyBonus(); Assert.AreEqual(expected, actual, 0.001, "Master Bonus not calculating correctly"); }
public void ExpertTest() { int expected = 11; Proficiency proficiency = new Proficiency(Levels.expert, this.level); int actual = proficiency.ProficiencyBonus(); Assert.AreEqual(expected, actual, 0.001, "Expert Bonus not calculating correctly"); }
public void TrainedTest() { int expected = 9; Proficiency proficiency = new Proficiency(Levels.trained, this.level); int actual = proficiency.ProficiencyBonus(); Assert.AreEqual(expected, actual, 0.001, "Trained Bonus not calculating correctly"); }
public IActionResult ProficienciesCreate(int id) { var proficiency = new Proficiency { CandidateID = id }; return(View(nameof(ProficienciesCreate), proficiency)); }
// GET api/Proficiency public IEnumerable <Proficiency> Get() { this.OnBeforeGet(); var results = this.SDM.GetAllProficiencies <Proficiency>(); Proficiency.CheckExpand(this.SDM, results, HttpContext.Current.Request["expand"]); this.OnAfterGet(results); return(results); }
public Skill(Characteristic mainCharacteristic, string skillName, int profBonus, Proficiency prof) { MainCharacteristic = mainCharacteristic; Type = mainCharacteristic.Type; Prof = prof; ProfBonus = profBonus; SkillName = skillName; Bonus = 0; Bonus = CalculateBonus(prof); }
public void ProficiencyAndLevel_ReturnsAppropriateBonus(Proficiency proficiency, int expectedBonus) { //arrange Setup(); //act ProficiencyBonus bonus = new ProficiencyBonus(level, proficiency); //assert Assert.AreEqual(expectedBonus, bonus.Amount); }
public void AddExperience3() { Proficiency proficiency = new Proficiency(typeof(FireMagic), Proficiency.Rank.S); proficiency.AddExperience(90); Assert.AreEqual(90, proficiency.Experience); proficiency.AddExperience(11); Assert.AreEqual(101, proficiency.Experience); Assert.AreEqual(Proficiency.Rank.S, proficiency.ProficiencyRank); }
/// <summary> /// Called when player successfully avoids an attack /// </summary> public override void OnEvade(WorldObject attacker, CombatType attackType) { if (UnderLifestoneProtection) { return; } // http://asheron.wikia.com/wiki/Attributes // Endurance will also make it less likely that you use a point of stamina to successfully evade a missile or melee attack. // A player is required to have Melee Defense for melee attacks or Missile Defense for missile attacks trained or specialized // in order for this specific ability to work. This benefit is tied to Endurance only, and it caps out at around a 75% chance // to avoid losing a point of stamina per successful evasion. var defenseSkillType = attackType == CombatType.Missile ? Skill.MissileDefense : Skill.MeleeDefense; var defenseSkill = GetCreatureSkill(defenseSkillType); if (CombatMode != CombatMode.NonCombat) { if (defenseSkill.AdvancementClass >= SkillAdvancementClass.Trained) { var enduranceBase = Endurance.Base; // TODO: find exact formula / where it caps out at 75% var enduranceCap = 400; var effective = Math.Min(enduranceBase, enduranceCap); var noStaminaUseChance = effective / enduranceCap * 0.75f; if (noStaminaUseChance < ThreadSafeRandom.Next(0.0f, 1.0f)) { UpdateVitalDelta(Stamina, -1); } } else { UpdateVitalDelta(Stamina, -1); } } else { UpdateVitalDelta(Stamina, -1); } Session.Network.EnqueueSend(new GameMessageSystemChat($"You evaded {attacker.Name}!", ChatMessageType.CombatEnemy)); var creature = attacker as Creature; if (creature == null) { return; } var difficulty = creature.GetCreatureSkill(creature.GetCurrentWeaponSkill()).Current; // attackMod? Proficiency.OnSuccessUse(this, defenseSkill, difficulty); }
public static bool Update(Proficiency proficiency) { proficiency.Name = proficiency.Name.ToUpper(); if (GetByName(proficiency) == null) { ctx.Entry(proficiency).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); return(true); } return(false); }
public ProficiencyBasedNumber(Proficiency proficiency, int level, int modifierBonus, bool isDC = false, int itemBonus = 0) { Proficiency = proficiency; ItemBonus = itemBonus; ProficiencyBonus = (int)Proficiency + level; Amount = ProficiencyBonus + ItemBonus + modifierBonus; if (isDC) { Amount += 10; } }
// POST api/Proficiencies/{proficiency-guid} public Proficiency Put([FromBody] Proficiency proficiency) { if (proficiency.ProficiencyId == Guid.Empty) { proficiency.ProficiencyId = Guid.NewGuid(); } this.OnBeforePut(proficiency); this.SDM.Upsert(proficiency); this.OnAfterPut(proficiency); return(proficiency); }
public void NewSavesHaveCorrectPropertyCalculations( Proficiency prof, int itemBonus, int level, int modifier, int expected) { var save = new ProficiencyBasedNumber(prof, level, modifier, false, itemBonus); Assert.That(expected, Is.EqualTo(save.Amount)); }
public ArmorClass(Proficiency proficiency, int level, int modifierBonus, Armor armor, bool isDC = false, int itemBonus = 0) : base(proficiency, level, modifierBonus, isDC) { Total = armor.ACBonus + Math.Min(armor.DexCap, modifierBonus) + ProficiencyBonus + 10; }
public static Proficiency Get(int?id) { Proficiency proficiency = new Proficiency(); try { proficiency = ctx.Proficiencys.Find(id); } catch (Exception e) { } return(proficiency); }
/// <summary> /// Called when a player hits a target /// </summary> public override void OnDamageTarget(WorldObject target, CombatType attackType, bool critical) { if (critical) { target.EmoteManager.OnReceiveCritical(this); } var attackSkill = GetCreatureSkill(GetCurrentWeaponSkill()); var difficulty = GetTargetEffectiveDefenseSkill(target); Proficiency.OnSuccessUse(this, attackSkill, difficulty); }
public PosativePool(int ablDice, int bstDice, int profDice) { this.ablDice = ablDice; this.bstDice = bstDice; this.profDice = profDice; ability = new Ability(); boost = new Dice.Boost(); proficiency = new Proficiency(); for (int i = 0; i < posativeOutcome.Length; i++) { posativeOutcome[i] = 0; } }
public ActionResult AddSkill(Guid selectedInstrumentId, Proficiency proficiency) { var user = GetCurrentUser(); var newSkill = new InstrumentSkill { ApplicationUser = user, Instrument = _db.Instruments.Find(selectedInstrumentId), Proficiency = (Proficiency)proficiency }; user.InstrumentSkills.Add(newSkill); _db.SaveChanges(); return RedirectToAction("ModSkills", "Users", user); }
private void buttonSave_Click(object sender, EventArgs e) { Proficiency pf = new Proficiency(); pf.Name = textFieldProfName.Text; pf.Type = (ProfType)comboBoxProfType.ComboBox.SelectedIndex; pf.DerivedStat = comboBoxFieldDerivedStat.ComboBox.SelectedIndex != -1 ? (NotationType)comboBoxFieldDerivedStat.ComboBox.SelectedIndex : NotationType.PROF; Data.AddProficiency(pf); ClearForm(); UpdateIndex(); }
/// <summary> /// Gets the weapon at the specified index if the proficieny allows it /// </summary> /// <param name="index">The index of the weapon</param> /// <param name="prof">The characters proficiency</param> /// <param name="weapon">The actual weapon that is returned. Null if the character does not meet the required proficiency</param> /// <returns>Returns true if the character can use the weapon with the supplied proficieny</returns> public bool GetWeapon(int index, Proficiency prof, out Transform weapon, WeaponType weaponType) { // Check to see if the proficieny of the character can use this item if ((prof.wepFlags & WeaponFlagType(weaponType)) != Proficiency.WeaponFlags.none) { weapon = swords[index]; return true; } else { weapon = null; return false; } }
private static Term[] getProficiencyPerShift(int i_Shift, Proficiency i_Proficiency) { List<Term> profList = new List<Term>(); profList.Add(0); for (int i = 0; i < m_DecisionList.GetLength(0); i++) { if (Management.Employees[i].Proficiency == i_Proficiency) { profList.Add(m_DecisionList[i, i_Shift]); } } return profList.ToArray(); }
/// <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); }