public AttackingPlayer(Weapon weapon, int combatLevel, AccuracyModifier accuracyMod, AffinityModifier affinityMod)
 {
     this.combatLevel = combatLevel;
     this.weapon      = weapon;
     this.affinityMod = affinityMod;
     this.accuracyMod = accuracyMod;
 }
Exemple #2
0
    //  Add up all active effects into one final effect for each category
    private void DetermineEffects()
    {
        //  Reset all effects
        accMod      = new AccuracyModifier();
        levelMod    = new LevelModifier();
        hcMod       = new HitChanceModifier();
        affinityMod = new AffinityModifier();

        //  O(n) time since we need to either cache or recalculate all effects
        //  I chose to calculate since I have previously cached most values so this simply goes through each effect; hence O(n)
        //  List<List<AbsEffect>>
        foreach (ModifierList list in modLists)
        {
            //  List<AbsEffect>
            foreach (AbsEffect effect in list.ActiveEffects())
            {
                AddEffect(effect);
            }
        }

        //  Set each modifier and calculate hit chance
        model.SetAccuracyMod(in accMod);
        model.SetLevelMod(in levelMod);
        model.SetHitChanceMod(in hcMod);
        model.SetAffinityMod(in affinityMod);
        CalculateHitChance();
    }
Exemple #3
0
 public HitChance(int combatLevel, int weaponAccTier)
 {
     this.combatLevel   = combatLevel;
     this.weaponAccTier = weaponAccTier;
     this.attStyle      = (AttackType.AttackStyles) 1; //  0 is none so initiate to 1
     affinityModifier   = new AffinityModifier();
     lvlModifier        = new LevelModifier();
     accuracyModifier   = new AccuracyModifier();
     hitChanceModifier  = new HitChanceModifier();
 }
Exemple #4
0
    //  Add each effect to its proper variable based on EffectType
    private void AddEffect(AbsEffect effect)
    {
        switch (effect.EffectType)
        {
        case AbsEffect.EffectTypes.Level:
            levelMod += (LevelModifier)effect;
            break;

        case AbsEffect.EffectTypes.Accuracy:
            accMod += (AccuracyModifier)effect;
            break;

        case AbsEffect.EffectTypes.HitChance:
            hcMod += (HitChanceModifier)effect;
            break;

        case AbsEffect.EffectTypes.Affinity:
            affinityMod += (AffinityModifier)effect;
            break;

        default:
            break;
        }
    }