private float GetEffectivenessModifier(Effectiveness eff)
    {
        // returns the damage multiplier for a type's effectiveness
        // resisting halves or quarters the damage, while weak doubles or quadruples it
        switch (eff)
        {
        case Effectiveness.immune:
            return(0f);

        case Effectiveness.resist2x:
            return(0.5f);

        case Effectiveness.resist4x:
            return(0.25f);

        case Effectiveness.weak2x:
            return(2f);

        case Effectiveness.weak4x:
            return(4f);

        default:
            return(1f);
        }
    }
Exemple #2
0
        public IEnumerator TriggerHitAnimation(bool isPlayer, Effectiveness effectiveness)
        {
            AnimatorWrapper animator = isPlayer ? PlayerStatusAnimator : OpponentStatusAnimator;

            yield return(DeltAttack(isPlayer));

            switch (effectiveness)
            {
            case Effectiveness.Ineffective:
                SoundEffectManager.Inst.PlaySoundImmediate("Boing");
                break;

            case Effectiveness.VeryWeak:
            case Effectiveness.Weak:
                SoundEffectManager.Inst.PlaySoundImmediate("PlayerAttackWeak");
                break;

            case Effectiveness.Strong:
            case Effectiveness.VeryStrong:
                SoundEffectManager.Inst.PlaySoundImmediate("PlayerAttackStrong");
                break;

            case Effectiveness.Average:
            default:
                SoundEffectManager.Inst.PlaySoundImmediate("PlayerAttack");
                break;
            }
        }
    public int ChangeElementalDamage(Effectiveness effect, int damage)
    {
        switch (effect)
        {
        case Effectiveness.weak:
            Create_weakness_text("WEAK");
            return((int)(damage * 1.25));

        case Effectiveness.resistent:
            Create_weakness_text("RESISTEND");
            return(damage / 2);

        case Effectiveness.immun:
            Create_weakness_text("NULL");
            return(0);

        case Effectiveness.absorb:
            Create_weakness_text("ABSORB");
            Heal((int)(damage / 1.5f), true);
            return(0);

        default:
            return(damage);
        }
    }
Exemple #4
0
    public float EffectivenessValue(Effectiveness effectiveness)
    {
        switch (effectiveness)
        {
        case Effectiveness.Ineffective:
            return(0);

        case Effectiveness.VeryWeak:
            return(0.25f);

        case Effectiveness.Weak:
            return(0.5f);

        case Effectiveness.Average:
            return(1);

        case Effectiveness.Strong:
            return(2);

        case Effectiveness.VeryStrong:
            return(4);

        default:
            return(1);
        }
    }
Exemple #5
0
    public void SetElemetalText(Effectiveness effectiveness, Text _text)
    {
        string _string = "";

        switch (effectiveness)
        {
        case Effectiveness.normal:
            _string = "";
            break;

        case Effectiveness.resistent:
            _string     = "Resistent";
            _text.color = Color.black;
            break;

        case Effectiveness.immun:
            _string     = "Immun";
            _text.color = Color.black;
            break;

        case Effectiveness.absorb:
            _string     = "Absorb";
            _text.color = Color.green;
            break;

        case Effectiveness.weak:
            _string     = "Weak";
            _text.color = Color.red;
            break;
        }


        _text.text = _string;
    }
        public static List <Effectiveness> GetMasterTrainingEffectivenessDetails()
        {
            DataAccessClass      daTrainingCourse = new DataAccessClass();
            List <Effectiveness> lstEffDtls       = new List <Effectiveness>();

            try
            {
                daTrainingCourse.OpenConnection(DBConstants.GetDBConnectionString());
                SqlParameter[] sqlParam = new SqlParameter[1];
                sqlParam[0]       = new SqlParameter("@Category", SqlDbType.VarChar, 50);
                sqlParam[0].Value = "TrainingEffectiveness";
                SqlDataReader dr = daTrainingCourse.ExecuteReaderSP(SPNames.TNI_GetMasterSP, sqlParam);

                while (dr.Read())
                {
                    Effectiveness teff = new Effectiveness();
                    teff.EffectivenessID   = Convert.ToInt32(dr[DbTableColumn.TrainingEffectivenessID]);
                    teff.EffectivenessName = Convert.ToString(dr[DbTableColumn.TrainingEffectivenessName]);
                    teff.IsSelected        = false;
                    lstEffDtls.Add(teff);
                }
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, clsCommonRepository, "GetTrainingEffectivenessDetails", EventIDConstants.TRAINING_DATA_ACCESS_LAYER);
            }
            finally
            {
                daTrainingCourse.CloseConncetion();
            }
            return(lstEffDtls);
        }
    public virtual void Damage(int amount, Effectiveness effectiveness, PlayerController controller = null)
    {
        var dashing = GetComponent <Dashing>();

        if ((dashing && dashing.isDashing) || effectiveness == Effectiveness.REDUCED || !canBeDamaged)
        {
            return;
        }

        canBeDamaged = false;
        Invincibility();
        switch (effectiveness)
        {
        case Effectiveness.REDUCED:
            break;

        case Effectiveness.SUPER:
            currentHealth -= amount * 2;
            break;

        case Effectiveness.NORMAL:
            currentHealth -= amount;
            break;
        }
        if (currentHealth <= 0)
        {
            passedController = controller;
            currentHealth    = 0;
            Die();
        }
    }
        public override void Compute()
        {
            TLSimilarityMatrix       sims    = (TLSimilarityMatrix)Workspace.Load("Similarities");
            TLSimilarityMatrix       goldset = (TLSimilarityMatrix)Workspace.Load("GoldSet");
            Dictionary <int, string> qmap    = (Dictionary <int, string>)Workspace.Load("QueryMap");

            Workspace.Store("EffectivenessMeasures", Effectiveness.Calculate(ref sims, ref goldset, qmap, _config.ModelName));
        }
        public override void Compute()
        {
            TLSimilarityMatrix    sims    = (TLSimilarityMatrix)Workspace.Load("SimilarityMatrix");
            TLSimilarityMatrix    gold    = (TLSimilarityMatrix)Workspace.Load("GoldSet");
            TLArtifactsCollection queries = (TLArtifactsCollection)Workspace.Load("Queries");

            Effectiveness.Export(queries, sims, gold, _config.AllMethodsFile, _config.BestMethodsFile);
        }
        public override void Compute()
        {
            TLSimilarityMatrix       sims    = (TLSimilarityMatrix)Workspace.Load("Similarities");
            TLSimilarityMatrix       goldset = (TLSimilarityMatrix)Workspace.Load("GoldSet");
            Dictionary <int, string> qmap    = (Dictionary <int, string>)Workspace.Load("QueryMap");

            Effectiveness.Export(ref sims, ref goldset, qmap, _config.Directory.Absolute, _config.Prefix);
        }
Exemple #11
0
 private static void addLabels(PokeType type, JArray otherTypes, Effectiveness level)
 {
     foreach (JToken otherTypeToken in otherTypes)
     {
         String   otherName = (string)otherTypeToken["name"];
         PokeType otherType = cachedTypeNames[otherName];
         effectivenessMatrix[type.Id, otherType.Id] = level;
     }
 }
Exemple #12
0
 public TypingEffectiveness()
 {
     nameAttack  = new List <string>();
     nameDefense = new List <string>();
     effect      = Effectiveness.None;
     foreach (var item in TypeChart.chart.m_types)
     {
         nameAttack.Add(item);
         nameDefense.Add(item);
     }
 }
Exemple #13
0
 public override void Damage(int amount, Effectiveness effectiveness, PlayerController passedController = null)
 {
     base.Damage(amount, effectiveness);
     if (controller.playerNumber == Controller.ControllerType.PLAYER_ONE)
     {
         UIController.Instance.UpdateHearts(0);
     }
     else if (controller.playerNumber == Controller.ControllerType.PLAYER_TWO)
     {
         UIController.Instance.UpdateHearts(1);
     }
 }
Exemple #14
0
        string GetEffectivenessMessage(Effectiveness effectiveness)
        {
            switch (effectiveness)
            {
            case Effectiveness.VeryStrong: return("It hit harder than the Shasta Trash Scandal!");

            case Effectiveness.Strong: return("It's super effective!");

            case Effectiveness.Weak: return("It's not very effective...");

            case Effectiveness.VeryWeak: return("It's weaker than O'Douls...");
            }
            throw new Exception("Trying to print effectiveness message that is unimplemented: " + effectiveness);
        }
Exemple #15
0
        static void Main(string[] args)
        {
            Dictionary <string, string> config = new Dictionary <string, string>();
            string relativeLocation            = "..\\..\\..\\..\\";

            config.Add("idPath", System.IO.Path.Combine(relativeLocation, "Experiment\\Rhino\\RhinoCorpusMapping.txt"));
            config.Add("docPath", System.IO.Path.Combine(relativeLocation, "Experiment\\Rhino\\RhinoCorpus.txt"));
            config.Add("qidPath", System.IO.Path.Combine(relativeLocation, "Experiment\\Rhino\\RhinoListOfFeatures.txt"));
            config.Add("qdocPath", System.IO.Path.Combine(relativeLocation, "Experiment\\Rhino\\RhinoQueries.txt"));
            config.Add("goldSetDir", System.IO.Path.Combine(relativeLocation, "Experiment\\Rhino\\RhinoFeaturesToGoldSetMethodsMapping"));
            config.Add("effAllPath", System.IO.Path.Combine(relativeLocation, "Experiment\\EffectivenessAllMethods.txt"));
            config.Add("effBestPath", System.IO.Path.Combine(relativeLocation, "Experiment\\EffectivenessBestMethods.txt"));

            Console.WriteLine("Running experiment...");
            Console.WriteLine("Importing corpus...");
            TLArtifactsCollection corpusArtifacts = Corpus.Import(config["idPath"], config["docPath"]);

            Console.WriteLine("Computing corpus vectors...");
            Vectorizer corpusVectors = new Vectorizer(corpusArtifacts, "Ordinal");

            Console.WriteLine("Computing corpus tf, df...");
            Normalizer corpusTF = new Normalizer(corpusVectors.Vectors);

            Console.WriteLine("Computing corpus idf...");
            NormalizedVector corpusIDF = InverseDocumentFrequency.Compute(corpusVectors.Frequencies, corpusVectors.Vectors.Count);

            Console.WriteLine("Computing corpus tf-idf...");
            NormalizedVectorCollection corpusTFIDF = TFIDF.Compute(corpusTF.Vectors, corpusIDF);

            Console.WriteLine("Importing queries...");
            TLArtifactsCollection queryArtifacts = Corpus.Import(config["qidPath"], config["qdocPath"]);

            Console.WriteLine("Computing corpus vectors...");
            Vectorizer queryVectors = new Vectorizer(queryArtifacts, "Boolean");

            Console.WriteLine("Computing similarities...");
            TLSimilarityMatrix sims = CosineSimilarity.Compute(corpusTF.Vectors, corpusTF.Lengths, queryVectors.Vectors);

            Console.WriteLine("Importing gold set...");
            TLSimilarityMatrix goldset = AnswerMapping.Import(config["goldSetDir"]);

            Console.WriteLine("Calculating effectiveness measures...");
            Effectiveness.Export(queryArtifacts, sims, goldset, config["effAllPath"], config["effBestPath"]);
            Console.WriteLine("Effectiveness measures written to:\n\t" + config["effAllPath"] + "\n\t" + config["effBestPath"]);
            Console.WriteLine("Experiment complete.");

            Console.WriteLine("\nPress enter key to continue...");
            Console.ReadLine();
        }
Exemple #16
0
    public void ApplyEffectivness(Element element, Effectiveness effect)
    {
        switch (element)
        {
        case Element.Fire:
            fire = effect;
            break;

        case Element.Ice:
            ice = effect;
            break;

        case Element.Thunder:
            thunder = effect;
            break;
        }
    }
Exemple #17
0
        void PerformMoveDamage()
        {
            Effectiveness  effectiveness = Move.GetEffectivenessAgainst(DefendingDelt);
            BattleAnimator animator      = BattleManager.Inst.Animator;

            BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("Attack", IsPlayer));
            // yield return new WaitForSeconds(0.4f); // REFACTOR_TODO: Animations added to the queue

            bool  isCrit    = false;
            float rawDamage = Move.GetMoveDamage(AttackingDelt, DefendingDelt, State, IsPlayer);

            // If a critical hit
            if (Random.Range(0, 100) <= Move.critChance)
            {
                rawDamage = rawDamage * 1.75f;
                isCrit    = true;
            }

            // Multiply by random number from 0.85-1.00
            rawDamage = rawDamage * (0.01f * (float)Random.Range(85, 100));

            // Return final damage
            DefendingDelt.health = DefendingDelt.health - rawDamage;

            BattleManager.AddToBattleQueue(enumerator: animator.TriggerHitAnimation(IsPlayer, effectiveness));
            BattleManager.AddToBattleQueue(enumerator: animator.AnimateHurtDelt(!IsPlayer));

            if (isCrit)
            {
                BattleManager.AddToBattleQueue(message: "It's a critical hit!");
            }

            if (effectiveness != Effectiveness.Average)
            {
                BattleManager.AddToBattleQueue(message: GetEffectivenessMessage(effectiveness));
            }

            // If Delt passed out
            if (DefendingDelt.health <= 0)
            {
                DefendingDelt.health = 0;
                BattleManager.AddToBattleQueue(message: DefendingDelt.nickname + " has DA'd!");
                BattleManager.Inst.StatusChange(!IsPlayer, statusType.DA);
            }
        }
Exemple #18
0
    public void SetBody(PlayerBody newBody)
    {
        strenght   = newBody.strenght;
        intellect  = newBody.intellect;
        defence    = newBody.defence;
        resistance = newBody.resistance;


        Ability_typs[2].abilities.Clear();
        for (int i = 0; i < 8; i++)
        {
            if (newBody.abilities.Length <= i || newBody.abilities[i] == null)
            {
                break;
            }
            Ability_typs[2].abilities.Add(newBody.abilities[i]);
        }
        Ability_typs[2].slots = Ability_typs[2].abilities.Count;

        if (GetComponentInChildren <Animator>())
        {
            animator = GetComponentInChildren <Animator>();
            animator.runtimeAnimatorController = newBody.animaton;
        }

        if (GetComponentInChildren <SpriteRenderer>())
        {
            sprite        = GetComponentInChildren <SpriteRenderer>();
            sprite.sprite = newBody.sprite;
        }
        fire          = newBody.fire;
        ice           = newBody.ice;
        thunder       = newBody.thunder;
        passiveSkills = newBody.passiveSkills;
        foreach (Effects.Buff _buff in _buffs)
        {
            ApplyBuff(_buff, 1);
        }
        //BodySwapPartical();
        if (UI != null)
        {
            UI.Set_UI();
        }
    }
Exemple #19
0
    private void executeMove(PokemonData attackingPokemon, PokemonData defendingPokemon, Move move)
    {
        if (!calculator.willMoveHit(attackingPokemon, defendingPokemon, move))
        {
            if (attackingPokemon.Equals(getActiveOwnPokemon()))
            {
                enqueueBattleEventDelegate(
                    new TextMessageEvent(attackingPokemon.basePokemon.name + "'s "
                                         + " attack missed!"));
            }
            else
            {
                enqueueBattleEventDelegate(
                    new TextMessageEvent("Foe " + attackingPokemon.basePokemon.name + "'s "
                                         + " attack missed!"));
            }

            return;
        }

        if (move.effect.Equals(Effect.Physical) || move.effect.Equals(Effect.Special))
        {
            int damage = calculator.calculateDamage(attackingPokemon, defendingPokemon, move);

            Effectiveness effectiveness
                = calculator.decideEffectiveness(move, defendingPokemon.basePokemon);

            if (effectiveness.Equals(Effectiveness.TwiceWeak))
            {
                damage = damage * 2;
            }

            defendingPokemon.currentHp = defendingPokemon.currentHp - damage;

            enqueueBattleEventDelegate(new MoveEvent(defendingPokemon, move));

            if (effectiveness.Equals(Effectiveness.TwiceWeak))
            {
                enqueueBattleEventDelegate(
                    new TextMessageEvent("It's super effective!"));
            }

            if (defendingPokemon.currentHp < 1)
            {
                faintPokemon(defendingPokemon);
            }

            // TODO separete effectiveness in a separate class
        }
        // TODO missing speed change
        if (move.effect.Equals(Effect.StatusEnemyAttack))
        {
            if (defendingPokemon.attackStatisticsChange > -6)
            {
                defendingPokemon.attackStatisticsChange -= 1;

                enqueueBattleEventDelegate(
                    new TextMessageEvent(defendingPokemon.basePokemon.name + "'s "
                                         + " ATTACK fell!"));
            }
            else
            {
                enqueueBattleEventDelegate(
                    new TextMessageEvent(defendingPokemon.basePokemon.name + "'s "
                                         + " ATTACK cannot go any lower."));
            }
        }
        if (move.effect.Equals(Effect.StatusEnemyDefense))
        {
            if (defendingPokemon.defenseStatisticsChange > -6)
            {
                defendingPokemon.defenseStatisticsChange -= 1;

                enqueueBattleEventDelegate(
                    new TextMessageEvent(defendingPokemon.basePokemon.name + "'s "
                                         + " DEFENSE fell!"));
            }
            else
            {
                enqueueBattleEventDelegate(
                    new TextMessageEvent(defendingPokemon.basePokemon.name + "'s "
                                         + " DEFENSE cannot go any lower."));
            }
        }
        if (move.effect.Equals(Effect.StatusEnemyAccuracy))
        {
            if (defendingPokemon.accuracyStatisticsChange > -6 && defendingPokemon.accuracyStatisticsChange < 6)
            {
                defendingPokemon.accuracyStatisticsChange -= 1;

                enqueueBattleEventDelegate(
                    new TextMessageEvent(defendingPokemon.basePokemon.name + "'s "
                                         + " ACCURACY fell!"));
            }
            else
            {
                enqueueBattleEventDelegate(
                    new TextMessageEvent(defendingPokemon.basePokemon.name + "'s "
                                         + " ACCURACY cannot go any lower."));
            }
        }
    }
Exemple #20
0
        private void LoadModel()
        {
            _loading = true;
            RemoveEventSubscriptions();

            _notAssessedPalette.Clear();
            _shortTermPalette.Clear();
            _midTermPalette.Clear();
            _longTermPalette.Clear();
            _noActionRequiredPalette.Clear();

            var mitigations = _model?.GetUniqueMitigations()?.OrderBy(x => x.Name).ToArray();

            if ((mitigations?.Any() ?? false) && _filter != null)
            {
                mitigations = _filter.Filter(mitigations)?.ToArray();
            }

            if (mitigations?.Any() ?? false)
            {
                var schemaManager     = new ResidualRiskEstimatorPropertySchemaManager(_model);
                var effectivenessDict =
                    schemaManager.SelectedEstimator?.CategorizeMitigations(_model);

                foreach (var mitigation in mitigations)
                {
                    Effectiveness effectiveness = Effectiveness.Unknown;
                    if (effectivenessDict?.ContainsKey(mitigation.Id) ?? false)
                    {
                        effectiveness = effectivenessDict[mitigation.Id];
                    }

                    var status = mitigation.GetStatus(out var automatedCalculation);
                    var node   = new RoadmapItem(mitigation, effectiveness);
                    if (_actions != null)
                    {
                        node.SetContextAwareActions(_actions);
                    }

                    switch (status)
                    {
                    case RoadmapStatus.NotAssessed:
                        _notAssessedPalette.AddNode(node);
                        break;

                    case RoadmapStatus.ShortTerm:
                        _shortTermPalette.AddNode(node);
                        break;

                    case RoadmapStatus.MidTerm:
                        _midTermPalette.AddNode(node);
                        break;

                    case RoadmapStatus.LongTerm:
                        _longTermPalette.AddNode(node);
                        break;

                    case RoadmapStatus.NoActionRequired:
                        _noActionRequiredPalette.AddNode(node);
                        if (automatedCalculation)
                        {
                            mitigation.SetStatus(RoadmapStatus.NoActionRequired);
                        }
                        break;
                    }
                }

                _notAssessedPalette.RefreshNodes();
                _shortTermPalette.RefreshNodes();
                _midTermPalette.RefreshNodes();
                _longTermPalette.RefreshNodes();
                _noActionRequiredPalette.RefreshNodes();

                _chart.RefreshChart(_model);
            }

            _loading = false;
        }
Exemple #21
0
 /// <summary>
 /// Adds a skill interaction to a unit.
 /// </summary>
 /// <param name="hitAttribute">The <see cref="HitAttributes"/> value to be added.</param>
 /// <param name="effectiveness">The <see cref="Effectiveness"/> value attributed to the HitAttribute value.</param>
 public void AddSkillInteraction(HitAttributes hitAttribute, Effectiveness effectiveness)
 {
     skillInteractions.Add(hitAttribute, effectiveness);
 }
Exemple #22
0
        static void Main(string[] args)
        {
            var allMatchups = new List <(Type defender1, Type defender2, Type attacker, Effectiveness effectiveness, BattleType?battle)>();
            var whitelist   = new List <(Type defender1, Type?defender2, Type?attacker, Effectiveness effectiveness, BattleType?battle)>();
            var blacklist   = new List <(Type defender1, Type defender2, Type?attacker, Effectiveness effectiveness, BattleType?battle)>();

            for (Type defender1 = Type.normal; defender1 <= Type.fairy; defender1++)
            {
                for (Type defender2 = Type.normal; defender2 <= Type.fairy; defender2++)
                {
                    foreach (var effectiveness in GetEmptyEffectiveness(defender1, defender2, BattleType.normal))
                    {
                        whitelist.Add((defender1, defender2, null, effectiveness, BattleType.normal));
                        if (defender1 == defender2)
                        {
                            whitelist.Add((defender1, null, null, effectiveness, BattleType.normal));
                        }
                    }

                    foreach (var effectiveness in GetEmptyEffectiveness(defender1, defender2, BattleType.inverse))
                    {
                        if (effectiveness == Effectiveness.immune)
                        {
                            // We are hiding all immunities as there are none
                            continue;
                        }
                        whitelist.Add((defender1, defender2, null, effectiveness, BattleType.inverse));
                        if (defender1 == defender2)
                        {
                            whitelist.Add((defender1, null, null, effectiveness, BattleType.inverse));
                        }
                    }

                    for (Type attacker = Type.normal; attacker <= Type.fairy; attacker++)
                    {
                        Effectiveness effectNorm = Classify(defender1, defender2, attacker, BattleType.normal);
                        Effectiveness effectInv  = Classify(defender1, defender2, attacker, BattleType.inverse);
                        if (effectNorm == effectInv)
                        {
                            allMatchups.Add((defender1, defender2, attacker, effectNorm, null));
                        }
                        else
                        {
                            allMatchups.Add((defender1, defender2, attacker, effectNorm, BattleType.normal));
                            allMatchups.Add((defender1, defender2, attacker, effectInv, BattleType.inverse));
                        }
                    }
                }
            }

            foreach (var matchup in allMatchups.Where(m => m.defender1 != m.defender2))
            {
                var match1 = Classify(matchup.defender1, matchup.defender1, matchup.attacker, matchup.battle ?? BattleType.normal);
                var match2 = Classify(matchup.defender2, matchup.defender2, matchup.attacker, matchup.battle ?? BattleType.normal);
                if (match1 != matchup.effectiveness)
                {
                    blacklist.Add((matchup.defender1, matchup.defender2, matchup.attacker, match1, matchup.battle));
                }
                if (match2 != matchup.effectiveness)
                {
                    blacklist.Add((matchup.defender1, matchup.defender2, matchup.attacker, match2, matchup.battle));
                }
                if (match1 != matchup.effectiveness && match2 != matchup.effectiveness)
                {
                    whitelist.Add((matchup.defender1, matchup.defender2, matchup.attacker, matchup.effectiveness, matchup.battle));
                }
            }

            var blacklistIrrelevantBattleModifier = blacklist.GroupBy(x => (x.defender1, x.defender2, x.attacker, x.effectiveness))
                                                    .Where(x => x.Count() >= 2)
                                                    .ToList();

            blacklist = blacklist
                        .Except(blacklistIrrelevantBattleModifier.SelectMany(x => x))
                        .Union(blacklistIrrelevantBattleModifier
                               .Select(x => x.First())
                               .Select(x => (x.defender1, x.defender2, x.attacker, x.effectiveness, (BattleType?)null))
                               )
                        .ToList();

            var singleMatchups = new List <(Type defender, Type attacker, Effectiveness effectiveness, BattleType?battle)>(
                allMatchups
                .Where(m => m.defender1 == m.defender2)
                .Select(m => (m.defender1, m.attacker, m.effectiveness, m.battle))
                );

            Write(singleMatchups, whitelist, blacklist);
        }
Exemple #23
0
 public EffectivnessKeyEntry(Effectiveness key, char symbol, double multiplier)
 {
     Key        = key;
     Symbol     = symbol;
     Multiplier = multiplier;
 }
Exemple #24
0
    float typeAdvantage(Character target)
    {
        float modifier = 1.0f;

        TileStats.type Enemy_Type = target.GetComponent <PokemonStats>().MyType;

        if (myType == TileStats.type.Fire)
        {
            if (Enemy_Type == TileStats.type.Grass)
            {
                modifier += 0.5f;
            }
            if (Enemy_Type == TileStats.type.Water)
            {
                modifier -= 0.5f;
            }
        }
        else if (myType == TileStats.type.Water)
        {
            if (Enemy_Type == TileStats.type.Fire)
            {
                modifier += 0.5f;
            }
            if (Enemy_Type == TileStats.type.Grass)
            {
                modifier -= 0.5f;
            }
        }
        else if (myType == TileStats.type.Grass)
        {
            if (Enemy_Type == TileStats.type.Water)
            {
                modifier += 0.5f;
            }
            if (Enemy_Type == TileStats.type.Fire)
            {
                modifier -= 0.5f;
            }
        }
        else if (myType == TileStats.type.Electric)
        {
            if (Enemy_Type == TileStats.type.Ground)
            {
                modifier = 0;
            }
            else if (Enemy_Type == TileStats.type.Flying)
            {
                //modifier += 0.5f;
            }
        }
        else if (myType == TileStats.type.Ground)
        {
            if (Enemy_Type == TileStats.type.Flying)
            {
                modifier = 0;
            }
            else if (Enemy_Type == TileStats.type.Electric)
            {
                //modifier += 0.5f;
            }
        }
        else if (myType == TileStats.type.Flying)
        {
            if (Enemy_Type == TileStats.type.Electric)
            {
                modifier = 0;
            }
            if (Enemy_Type == TileStats.type.Ground)
            {
                //modifier += 0.5f;
            }
        }

        if (modifier == 1.5)
        {
            effect = Effectiveness.SUPEREFFECTIVE;
        }
        else if (modifier == 1.0)
        {
            effect = Effectiveness.NORMAL;
        }
        else if (modifier == 0.5)
        {
            effect = Effectiveness.NOTEFFECTIVE;
        }

        return(modifier);
    }
Exemple #25
0
        public RoadmapItem([NotNull] IMitigation mitigation, Effectiveness effectiveness)
        {
            _mitigation = mitigation;

            PortBorderMargin = SizeF.Empty;

            Label.Text  = mitigation.Name;
            ToolTipText = mitigation.Name;

            switch (effectiveness)
            {
            case Effectiveness.Unknown:
                Label.TextColor   = Color.White;
                Header.BrushColor = ThreatModelManager.StandardColor;
                break;

            case Effectiveness.Minor:
                Label.TextColor       = Color.Black;
                Header.BrushColor     = Color.White;
                Header.BorderPenColor = Color.DarkGreen;
                break;

            case Effectiveness.Average:
                Label.TextColor       = Color.Black;
                Header.BrushColor     = Color.LimeGreen;
                Header.BorderPenColor = Color.LimeGreen;
                break;

            case Effectiveness.Major:
                Label.TextColor       = Color.White;
                Header.BrushColor     = Color.DarkGreen;
                Header.BorderPenColor = Color.DarkGreen;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(effectiveness), effectiveness, null);
            }

            if (effectiveness != Effectiveness.Unknown)
            {
                AddItem("Effectiveness", effectiveness.ToString());
            }
            var schemaManager = new EffortPropertySchemaManager(mitigation.Model);

            if (schemaManager.IsEffortSupported)
            {
                AddItem("Estimated Effort", CalculateMaxEffort(schemaManager).ToString());
            }

            var properties = ExtensionUtils.GetExtensions <IRoadmapPropertyProvider>()?.ToArray();

            if (properties?.Any() ?? false)
            {
                foreach (var property in properties)
                {
                    var propertyValue = property?.GetValue(mitigation);
                    if (propertyValue != null)
                    {
                        AddItem(property.Name, propertyValue);
                    }
                }
            }
        }