Exemple #1
0
        private Brush GetBrush(UniversalObject universalObject)
        {
            Brush brush = null;

            if (universalObject is Being)
            {
                Being being = universalObject as Being;
                if (being.IsAlive)
                {
                    return(GreenBrush);
                }
                else
                {
                    return(RedBrush);
                }
            }
            else
            {
                return(Graybush);
            }
        }
        public void Attack(UniversalObject target)
        {
            // first if it hits...
            // % based on attributes
            // of myself and
            int chanceOfHitting = (base.Attributes.Reactivity.Value - (target.Attributes.Reactivity.Value / 2));

            chanceOfHitting = chanceOfHitting < 25 ? 25 : chanceOfHitting;
            // bonuses and other stuff?!?!?!!???
            //not now it seems.. // TODO weapon bonuses, classees, if implemented, and other stufff

            int attempt = UnityEngine.Random.Range(1, 100);

            if (attempt < chanceOfHitting)
            {
                // HIT
                int dmg = (base.Attributes.Strength.Value / 10 + (EquippedWeapon ?? BaseWeapon).Damage);
                dmg = (int)Math.Round(dmg * ((double)UnityEngine.Random.Range(1, 10) / (double)10));
                target.Attributes.Durability -= dmg;

                Being item = target as Being;
                if (item != null && item.IsAlive)
                {
                    this.Attributes.AddXp(item.Attributes.XpWorth);
                    this.ShowLevelUp();
                }
                target.ShowHit();
                //  report.Hits = true;
            }
            else
            {
                // MISS
                ///  report.Hits = false;
            }

            //  return report;
        }