Example #1
0
 public DnDObject(ArmorClass ac, HitPoints hp, PhysicalProperties physicalProperties, Resistance resistance)
 {
     AC = ac;
     HP = hp;
     PhysicalProperties = physicalProperties;
     Resistance         = resistance;
 }
        public void MettreSousTensionParalleleTest()
        {
            Resistance[] res = new Resistance[4];
            res[0] = new Resistance(5);
            res[1] = new Resistance(4);
            res[2] = new Resistance(12);
            res[3] = new Resistance(8);

            double[] resRes      = { 5, 4, 12, 8 };
            double[] courrantRes = { 24, 30, 10, 15 };
            double[] tensionRes  = { 120, 120, 120, 120 };

            Circuit p = new CircuitParallele();

            foreach (Resistance r in res)
            {
                p.AddSousCircuit(r);
            }

            p.MettreSousTension(120);

            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(resRes[i], res[i].CalculerResistance(), 0.1);
                Assert.AreEqual(courrantRes[i], res[i].GetCourrant(), 0.1);
                Assert.AreEqual(tensionRes[i], res[i].GetTension(), 0.1);
            }
            Assert.AreEqual(1.518, p.CalculerResistance(), 0.1);
            Assert.AreEqual(79.05, p.GetCourrant(), 0.1);
            Assert.AreEqual(120, p.GetTension(), 0.1);
        }
        ////////////////////////////////////////////////////////////REQUÊTE AFIN DE RECUPERER TOUTES LES VIANDES UNITE//////////////////////////////////////////////

        public static List <Resistance> getNBBTouteslesResistances(string daterequete)
        {
            List <Resistance> NBBTouteslesResistances = new List <Resistance>();

            try
            {
                MySqlConnection cnx = MySQL.getCnx();
                cnx.Ping();
                string       requete = "SELECT DISTINCT RES_LIBELLE, resistance.RES_ID FROM resistance, reservationmenu, repas WHERE resistance.RES_ID = res_plat AND res_repas = REP_ID AND REP_DATE = '" + daterequete + "' ORDER BY RES_ID";
                MySqlCommand cmd     = new MySqlCommand(requete, cnx);
                var          reader  = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Resistance unResistance = new Resistance();
                    unResistance.Libelle = reader.GetString(0);
                    unResistance.Id      = reader.GetInt32(1);
                    NBBTouteslesResistances.Add(unResistance);
                }
                cnx.Close();
                return(NBBTouteslesResistances);
            }
            catch (MySqlException ex)
            {
                Resistance erreurSQL = new Resistance();
                erreurSQL.Description = (ex.ToString());
                NBBTouteslesResistances.Add(erreurSQL);
                return(NBBTouteslesResistances);
            }
        }
Example #4
0
    void ScaleStats(float playerLevel)
    {
        if (playerLevel == 0)
        {
            Health.CopyStatValue(baseHealth);
            Speed.CopyStatValue(baseSpeed);
            Strength.CopyStatValue(baseStrength);
            Resistance.CopyStatValue(baseResistance);

            currentHealth = Health.GetValue();
        }

        else
        {
            float modifiedHealth     = baseHealth + (playerLevel * 0.5f) + playerLevel;
            float modifiedSpeed      = Mathf.Clamp(baseSpeed + (playerLevel * 0.25f), baseSpeed, 15);
            float modifiedStrength   = baseStrength + (playerLevel * 0.5f) + playerLevel;
            float modifiedResistance = baseResistance + (playerLevel * 0.5f) + playerLevel;

            Health.CopyStatValue(modifiedHealth);
            Speed.CopyStatValue(modifiedSpeed);
            Strength.CopyStatValue(modifiedStrength);
            Resistance.CopyStatValue(modifiedResistance);

            currentHealth = Health.GetValue();
        }
    }
Example #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ResistanceID,EnergyTypeID,ResistanceValue,LastUpdateDate")] Resistance resistance)
        {
            if (id != resistance.ResistanceID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(resistance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ResistanceExists(resistance.ResistanceID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnergyTypeID"] = new SelectList(_context.EnergyTypes, "EnergyTypeID", "EnergyTypeID", resistance.EnergyTypeID);
            return(View(resistance));
        }
Example #6
0
	public static Resistance operator +(ResistanceConf x, ResistanceConf y) 
	{
		Resistance result = new Resistance();
		result.armor = x.armor + y.armor;
		result.flat = x.flat + y.flat;
		return result;
	}
        public void MettreSousTensionSerieTest()
        {
            Resistance[] res = new Resistance[4];
            res[0] = new Resistance(5);
            res[1] = new Resistance(4);
            res[2] = new Resistance(12);
            res[3] = new Resistance(8);

            double[] resRes      = { 5, 4, 12, 8 };
            double[] courrantRes = { 0.827, 0.827, 0.827, 0.827 };
            double[] tensionRes  = { 4.137, 3.31, 9.924, 6.616 };

            Circuit p = new CircuitSerie();

            foreach (Resistance r in res)
            {
                p.AddSousCircuit(r);
            }

            p.MettreSousTension(24);

            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(resRes[i], res[i].CalculerResistance(), 0.1);
                Assert.AreEqual(courrantRes[i], res[i].GetCourrant(), 0.1);
                Assert.AreEqual(tensionRes[i], res[i].GetTension(), 0.1);
            }

            Assert.AreEqual(29, p.CalculerResistance(), 0.1);
            Assert.AreEqual(0.827, p.GetCourrant(), 0.1);
            Assert.AreEqual(24, p.GetTension(), 0.1);
        }
 private void BindResistanceReason(Resistance resistance, List <string> reasonIds)
 {
     if (reasonIds != null)
     {
         foreach (var reasonItem in reasonIds)
         {
             int rid;
             var parseResult = int.TryParse(reasonItem, out rid);
             if (parseResult)
             {
                 resistance.ResistanceResistanceReasons.Add(new ResistanceResistanceReason {
                     ResistanceReasonId = rid, ResistanceId = resistance.Id
                 });
             }
             else
             {
                 var reason = _db.ResistanceReason.Add(new ResistanceReason {
                     Name = reasonItem
                 });
                 resistance.ResistanceResistanceReasons.Add(new ResistanceResistanceReason {
                     ResistanceReasonId = reason.Entity.Id
                 });
             }
         }
     }
 }
    // TODO Add documentation, clean up, remove commented out code, etc.
    public static float WorkOutAtResistance(ElectronicSupplyData ResistanceSources, IntrinsicElectronicData Indata)
    {
        float Resistanc = 0;

        if (Indata == null)
        {
            return(Resistanc);
        }

        bool goingToExists    = ResistanceSources.ResistanceGoingTo.TryGetValue(Indata, out VIRResistances goingTo);
        bool comingFromExists = ResistanceSources.ResistanceComingFrom.TryGetValue(Indata, out VIRResistances comingFrom);

        if (goingToExists && comingFromExists)
        {
            HashSet <ResistanceWrap> ResistanceSour = new HashSet <ResistanceWrap>(comingFrom.ResistanceSources);

            //ResistanceSour.UnionWith(ResistanceSources.ResistanceComingFrom[Indata].ResistanceSources);

            //HashSet<ResistanceWrap> ResistanceSour = new HashSet<ResistanceWrap>(ResistanceSources.ResistanceGoingTo[Indata].ResistanceSources);

            //ResistanceSourtoreove.UnionWith(ResistanceSources.ResistanceGoingTo[Indata].ResistanceSources);

            //ResistanceSour.ExceptWith(ResistanceSourtoreove);

            float Toadd    = 0;
            float ToRemove = 0;

            foreach (var Resistance in ResistanceSour)
            {
                if (goingTo.ResistanceSources.Contains(Resistance))
                {
                    Toadd = 1 / Resistance.Resistance();
                }

                //else {
                //	ToRemove = 1 / Resistance.Resistance();
                //}
            }

            if (Toadd != 0)
            {
                Toadd = 1 / Toadd;
            }

            Resistanc = Toadd - ToRemove;
        }
        else
        {
            if (comingFromExists)
            {
                Resistanc = comingFrom.Resistance();
            }
            else if (goingToExists)
            {
                Resistanc = goingTo.Resistance();
            }
        }

        return(Resistanc);
    }
Example #10
0
        public Dictionary <Feat, AbilityDetail> BuildAbilities()
        {
            var builder = new AbilityBuilder()
                          .Create(Feat.Sleep, PerkType.Sleep)
                          .Name("Sleep")
                          .HasRecastDelay(RecastGroup.Sleep, 12f)
                          .HasActivationDelay(2f)
                          .RequirementMP(8)
                          .UsesActivationType(AbilityActivationType.Casted)
                          .DisplaysVisualEffectWhenActivating()
                          .HasImpactAction((activator, target, level) =>
            {
                var resistance   = Resistance.GetResistance(target, ResistanceType.Sleep);
                var baseDuration = Random.NextFloat(15.0f, 30.0f);
                var duration     = baseDuration * resistance;

                StatusEffect.Apply(activator, target, StatusEffectType.Sleep, duration);
                Resistance.ModifyResistance(target, ResistanceType.Sleep, -0.25f);

                CombatPoint.AddCombatPoint(activator, target, SkillType.BlackMagic, 3);
                Enmity.ModifyEnmity(activator, target, 18);
            });

            return(builder.Build());
        }
Example #11
0
 private void RemoveResistance(Resistance resistance)
 {
     if (resistances.Contains(resistance))
     {
         resistances.Remove(resistance);
     }
 }
        public Character Attack(Character character, Attack attack)
        {
            //could verify that damage is positive here if that were a requirement

            int damage = attack.Damage;

            //keeping this simple by ignoring the case where the character has multiple defenses for the same type
            //that would be prevented by validation during character creation anyways
            if (character.Defenses != null)
            {
                Resistance resistance = character.Defenses.FirstOrDefault(defense => defense.Type == attack.Type);

                if (resistance == null)
                {
                    //don't modify damage in this case
                }
                else if (resistance.Defense == "immunity")
                {
                    damage = 0;
                }
                else if (resistance.Defense == "resistance")
                {
                    damage /= 2;
                }
            }

            int healthDamage = Math.Max(damage - character.TempHp, 0);             //get damage remaining

            character.TempHp    = Math.Max(character.TempHp - damage, 0);
            character.CurrentHp = Math.Max(character.CurrentHp - healthDamage, 0);

            return(_characterData.UpdateCharacter(character));
        }
    void Shoot()
    {
        Vector3 ubication = new Vector3(player.transform.position.x,
                                        player.transform.position.y + 1.1f,
                                        player.transform.position.z);

        timer = 0f;

        gunLine.enabled    = true;
        gunLight.enabled   = true;
        shootRay.origin    = ubication;
        shootRay.direction = transform.forward;
        gunLine.SetPosition(0, ubication);

        if (Physics.Raycast(shootRay, out shootHit, range, shootableMask))
        {
            //Destroy (shootHit.collider.gameObject);
            gunLine.SetPosition(1, shootHit.point);
            Resistance resist = shootHit.collider.gameObject.GetComponent <Resistance> ();
            if (resist != null)
            {
                Debug.Log(resist);
                resist.shooted(shootHit.point);
            }
        }
        else
        {
            Debug.Log("No hit");
            gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range);
        }
    }
 private void BindCorporation(Resistance resistance, List <string> corporationIds)
 {
     if (corporationIds != null)
     {
         foreach (var corporationItem in corporationIds)
         {
             int cid;
             var parseResult = int.TryParse(corporationItem, out cid);
             if (parseResult)
             {
                 resistance.ResistanceCorporations.Add(new ResistanceCorporation {
                     CorporationId = cid, ResistanceId = resistance.Id
                 });
             }
             else
             {
                 var corporation = _db.Corporation.Add(new Corporation {
                     Name = corporationItem
                 });
                 resistance.ResistanceCorporations.Add(new ResistanceCorporation {
                     CorporationId = corporation.Entity.Id
                 });
             }
         }
     }
 }
Example #15
0
        /// <inheritdoc/>
        public override XElement GetXml(string rootElemName, bool suppressDefaults)
        {
            XElement rootElem = new XElement(rootElemName);

            if (!suppressDefaults || !IsDefaultRefractoryPeriods)
            {
                rootElem.Add(new XAttribute("refractoryPeriods", RefractoryPeriods.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultResistance)
            {
                rootElem.Add(Resistance.GetXml("resistance", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultDecayRate)
            {
                rootElem.Add(DecayRate.GetXml("decayRate", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultResetV)
            {
                rootElem.Add(ResetV.GetXml("resetV", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultFiringThresholdV)
            {
                rootElem.Add(FiringThresholdV.GetXml("firingThresholdV", suppressDefaults));
            }

            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////REQUÊTE AFIN DE RECUPERER LES VIANDES/////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static List <Resistance> getlesResistances(string daterequete)
        {
            List <Resistance> lesResistances = new List <Resistance>();

            try
            {
                MySqlConnection cnx = MySQL.getCnx();
                cnx.Ping();
                string       requete = "SELECT RES_ID, RES_LIBELLE, RES_DESCRIPTION FROM resistance, repasresistance, repas WHERE RES_ID=RR_RESISTANCE AND RR_REPAS=REP_ID AND REP_DATE= '" + daterequete + "' ";
                MySqlCommand cmd     = new MySqlCommand(requete, cnx);
                var          reader  = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Resistance unResistance = new Resistance();
                    unResistance.Id          = reader.GetInt32(0);
                    unResistance.Libelle     = reader.GetString(1);
                    unResistance.Description = reader.GetString(2);
                    lesResistances.Add(unResistance);
                }
                cnx.Close();
                return(lesResistances);
            }
            catch (MySqlException ex)
            {
                Resistance erreurSQL = new Resistance();
                erreurSQL.Description = (ex.ToString());
                lesResistances.Add(erreurSQL);
                return(lesResistances);
            }
        }
        ////////////////////////////////////////////////////////////REQUÊTE AFIN DE RECUPERER le Nombres des  VIANDES//////////////////////////////////////////////

        public static List <Resistance> getNBlesResistances(string daterequete, int idres)
        {
            List <Resistance> NBlesResistances = new List <Resistance>();

            try
            {
                MySqlConnection cnx = MySQL.getCnx();
                cnx.Ping();
                string       requete = "SELECT  COUNT(res_plat) FROM reservationmenu, repas WHERE res_repas = REP_ID AND REP_DATE = '" + daterequete + "' AND  res_plat = " + idres + " ";
                MySqlCommand cmd     = new MySqlCommand(requete, cnx);
                var          reader  = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Resistance NBunResistance = new Resistance();
                    NBunResistance.Count = reader.GetInt32(0);
                    NBlesResistances.Add(NBunResistance);
                }
                cnx.Close();
                return(NBlesResistances);
            }
            catch (MySqlException ex)
            {
                Resistance erreurSQL = new Resistance();
                erreurSQL.Description = (ex.ToString());
                NBlesResistances.Add(erreurSQL);
                return(NBlesResistances);
            }
        }
Example #18
0
        /// <summary>
        /// Задает значения по умолчанию (значения по варианту).
        /// </summary>
        private void DefaultValues_Click(object sender, EventArgs e)
        {
            RangeFrom             = 0;
            RangeFromTextBox.Text = RangeFrom.ToString();
            RangeFromChecked      = true;

            RangeTo             = 0.05;
            RangeToTextBox.Text = RangeTo.ToString();
            RangeToChecked      = true;

            StepNumber             = 100;
            StepNumberTextBox.Text = StepNumber.ToString();
            StepNumberChecked      = true;

            InitialCondition             = 0;
            InitialConditionTextBox.Text = InitialCondition.ToString();
            InitialConditionChecked      = true;

            Resistance             = 1000;
            ResistanceTextBox.Text = Resistance.ToString();
            ResistanceChecked      = true;

            Capacity             = Math.Pow(10, -5);
            CapacityTextBox.Text = Capacity.ToString();
            CapacityChecked      = true;

            Voltage             = 10;
            VoltageTextBox.Text = Voltage.ToString();
            VoltageChecked      = true;
        }
Example #19
0
    void OnEnable()
    {
        Health.IncreaseStat(40);
        Speed.IncreaseStat(3);
        Strength.IncreaseStat(5);
        Resistance.IncreaseStat(0);

        Level.IncreaseStat(0);
        upgradePointCounter = 0;
        expCounter          = 0;
        scoreCounter        = 0;
        killCounter         = 0;

        currentHealth = Health.GetValue();

        playerDeathShader    = transform.GetChild(1).GetComponent <PlayerShader>();
        playerFloatingEffect = transform.GetChild(1).GetComponent <FloatEffects>();

        upgradePointText.text = upgradePointCounter.ToString();
        levelText.text        = Level.GetValue().ToString();
        scoreText.text        = scoreCounter.ToString();
        healthText.text       = Health.GetValue().ToString();
        speedText.text        = Speed.GetValue().ToString();
        strengthText.text     = Strength.GetValue().ToString();
        resistanceText.text   = Resistance.GetValue().ToString();

        levelUpBorder.color = Color.grey;

        objectPoolerReference = GetComponent <ActivatePlayer>().activateObjectManager;
    }
Example #20
0
        /// <inheritdoc />
        public override XElement GetXml(string rootElemName, bool suppressDefaults)
        {
            XElement rootElem = new XElement(rootElemName);

            if (!suppressDefaults || !IsDefaultSolverMethod)
            {
                rootElem.Add(new XAttribute("solverMethod", SolverMethod.ToString()));
            }
            if (!suppressDefaults || !IsDefaultSolverCompSteps)
            {
                rootElem.Add(new XAttribute("solverCompSteps", SolverCompSteps.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultStimuliDuration)
            {
                rootElem.Add(new XAttribute("stimuliDuration", StimuliDuration.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultTimeScale)
            {
                rootElem.Add(TimeScale.GetXml("timeScale", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultResistance)
            {
                rootElem.Add(Resistance.GetXml("resistance", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultRestV)
            {
                rootElem.Add(RestV.GetXml("restV", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultResetV)
            {
                rootElem.Add(ResetV.GetXml("resetV", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultRheobaseV)
            {
                rootElem.Add(RheobaseV.GetXml("rheobaseV", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultFiringThresholdV)
            {
                rootElem.Add(FiringThresholdV.GetXml("firingThresholdV", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultSharpnessDeltaT)
            {
                rootElem.Add(SharpnessDeltaT.GetXml("sharpnessDeltaT", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultAdaptationVoltageCoupling)
            {
                rootElem.Add(AdaptationVoltageCoupling.GetXml("adaptationVoltageCoupling", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultAdaptationTimeConstant)
            {
                rootElem.Add(AdaptationTimeConstant.GetXml("adaptationTimeConstant", suppressDefaults));
            }
            if (!suppressDefaults || !IsDefaultAdaptationSpikeTriggeredIncrement)
            {
                rootElem.Add(AdaptationSpikeTriggeredIncrement.GetXml("adaptationSpikeTriggeredIncrement", suppressDefaults));
            }

            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }
Example #21
0
 public ModifierResistance(Resistance resistance)
 {
     GenericResistance    = new Modifier(resistance.GenericResistance, Modifier.CalculateMode.ADD);
     ProjectileResistance = new Modifier(resistance.ProjectileResistance, Modifier.CalculateMode.ADD);
     KnockbackResistance  = new Modifier(resistance.KnockbackResistance, Modifier.CalculateMode.ADD);
     StructuralResistance = new Modifier(resistance.StructuralResistance, Modifier.CalculateMode.ADD);
 }
Example #22
0
    public override void GetProperties()
    {
        GameObject           propertiesContainer = GameObject.Find("PropertiesWindowContainer");
        EditObjectProperties script = propertiesContainer.GetComponent <EditObjectProperties>();

        script.AddString("ComponentNameLabel", _name, SetName);
        script.AddNumeric("ResistancePropertyLabel", Resistance.ToString(), Resistance.GetType().ToString(), SetResistance, true, 0, 150.6f);
    }
        public void AmperageMultipliedByResistance()
        {
            Resistance resistance = new Resistance(1000);
            Ampere     amperage   = new Ampere(120, resistance);
            double     answer     = OhmsLaw.CalculateVoltage(amperage, resistance);

            Assert.Equal(120000, answer);
        }
Example #24
0
 public Race(string id, string name, Realm realm, Resistance resistance, Stats stats)
 {
     this.Id         = id;
     this.Name       = name;
     this.Realm      = realm;
     this.Resistance = resistance;
     this.Stats      = stats;
 }
Example #25
0
        public void TypeDictionary_ConstraintAllowsSubclasses()
        {
            var mod = new Resistance();

            ConstrainedTDict.Set <Resistance>(mod);

            Assert.AreEqual(mod, ConstrainedTDict.Get <Resistance>());
        }
Example #26
0
        public void TestToStringMethod()
        {
            Resistance resistance = new Resistance();

            resistance.Value = 1200;

            Assert.AreEqual("1200Ω", resistance.ToString());
        }
Example #27
0
 public virtual void Awake()
 {
     animator        = this.GetComponent <Animator> ();
     sprite_renderer = this.GetComponent <SpriteRenderer> ();
     rb            = this.GetComponent <Rigidbody2D>();
     activeEffects = new List <Effect>();
     resistance    = GetComponent <Resistance> ();
 }
Example #28
0
        List <ListViewItem> IAccessoryModifier.ToListViewItems()
        {
            var collection     = new List <ListViewItem>();
            var resistanceItem = new ListViewItem(new[] { Type.ToString(), Resistance.ToString(CultureInfo.InvariantCulture) });

            collection.Add(resistanceItem);
            return(collection);
        }
Example #29
0
 public void AddResistance(Resistance resistance)
 {
     if (resistance != null && !resistances.Contains(resistance))
     {
         resistances.Add(resistance);
         resistance.OnAdd(owner);
     }
 }
Example #30
0
        public void TestCurrentCalculateMethod()
        {
            Voltage    voltage    = Voltage.make(5);
            Resistance resistance = Resistance.make(100);

            Current current = OhmsLaw.calculate(voltage, resistance);

            Assert.AreEqual(0.05F, current.Value);
        }
Example #31
0
        public void TestResistanceCalculateMethod()
        {
            Voltage voltage = Voltage.make(12);
            Current current = Current.make(0.5F);

            Resistance resistance = OhmsLaw.calculate(voltage, current);

            Assert.AreEqual(24F, resistance.Value);
        }
Example #32
0
	internal Reduction GetResistance(EDamageType type, Reduction a_arpen)
	{
		Resistance reduc;
		
		switch(type)
		{
		case EDamageType.Slashing :
			reduc = general + slashing;
			break;
			
		case EDamageType.Crushing :
			reduc = general + crushing;
			break;
			
		case EDamageType.Piercing :
			reduc = general + piercing;
			break;
			
		case EDamageType.Magic :
			reduc = general + magic;
			break;
			
		case EDamageType.True :
			reduc = new Resistance();
			break;
			
		default: 
			reduc = new Resistance();
			break;
		}
		
		Reduction result = new Reduction();
		result.percent = ComputePercentReduction(reduc.armor, a_arpen);
		result.flat = ComputeFlatReduction(reduc.flat, a_arpen);
		return result;
	}
 protected virtual void OnMaxValueChanged(Resistance? oldValue, Resistance? newValue)
 {
     this.SetScalarValue(ScalarMaxValueProperty, newValue);
 }
Example #34
0
 public Monster(int snoID, int monsterCategory, int race, int type, int powerType, 
     int resists)
     : base(snoID, (int)ActorCategory.Monster, (int)TeamType.Hostile)
 {
     MonsterCategory = (MonsterCategory)monsterCategory;
     MonsterRace = (MonsterRace)race;
     MonsterType = (MonsterType)type;
     PowerType = (MonsterPowerType)powerType;
     Resists = (Resistance)resists;
 }
 protected void SetScalarValue(DependencyProperty property, Resistance? quantity)
 {
     // we set this flag to prevent from setting scalar value changing quantity values.
     this.isUpdatingScalarValue = true;
     var value = quantity != null
         ? this.Unit.GetScalarValue(quantity.Value)
         : (double?)null;
     this.SetCurrentValue(property, value);
     this.isUpdatingScalarValue = false;
 }
Example #36
0
 public void addConnection(int n, Resistance r)
 {
     if (n == 1) if (!conn1.Contains(r)) conn1.Add(r);
     if (n == 2) if (!conn2.Contains(r)) conn2.Add(r);
 }