예제 #1
0
    // combination rules
    public static SpellAttributes operator +(SpellAttributes A, SpellAttributes B)
    {
        SpellAttributes result = new SpellAttributes();

        // manacost/power
        result.manaCost = A.manaCost + B.manaCost;
        result.power    = A.power + B.power;

        // channeltime, multiplicative version
        result.channelTime = A.channelTime * B.channelTime;

        // spell time stats, multiplicative version
        result.spellIncrement = A.spellIncrement * B.spellIncrement;
        result.spellTurnCost  = A.spellTurnCost * B.spellTurnCost;

        // target properties
        result.targettype    = (TargetType)Mathf.Max((int)A.targettype, (int)B.targettype);
        result.range         = Mathf.Max(A.range, B.range);
        result.relativeShape = (A.relativeShape.Count > B.relativeShape.Count) ? A.relativeShape : B.relativeShape;
        result.power        /= result.relativeShape.Count;  // to dilute power
        result.shootType     = (ShootType)Mathf.Max((int)A.shootType, (int)B.shootType);

        // spell type
        result.spellType = (SpellType)Mathf.Max((int)A.spellType, (int)B.spellType);

        return(result);
    }
예제 #2
0
        public static bool Has(this Spell spell, SpellAttributes toCheck)
        {
            if (spell == null)
                return false;

            return (spell.Attributes & toCheck) == toCheck;
        }
예제 #3
0
        private void PopulatePassive()
        {
            explicitTargetType = SpellExplicitTargetType.Caster;
            damageClass        = SpellDamageClass.None;
            spellDispel        = SpellDispelType.None;
            mechanic           = SpellMechanics.None;

            explicitCastTargets = SpellCastTargetFlags.UnitAlly;
            schoolMask          = 0;
            preventionType      = 0;
            attributes          = SpellAttributes.Passive;
            attributesExtra     = SpellExtraAttributes.DoesNotTriggerGcd | SpellExtraAttributes.IgnoreGcd | SpellExtraAttributes.NotStealable;
            attributesCustom    = SpellCustomAttributes.CastWithoutAnimation;

            targetEntityTypeMask  = EnityTypeMask.Unit;
            rangedFlags           = SpellRangeFlags.Default;
            interruptFlags        = 0;
            castIgnoringMechanics = 0;

            cooldownTime         = 0;
            categoryCooldownTime = 0;
            globalCooldownTime   = 0;
            castTime             = 0;
            minCastTime          = 0;

            minRangeHostile = 0;
            minRangeFriend  = 0;
            maxRangeHostile = 0;
            maxRangeFriend  = 0;
            speed           = 0;
        }
예제 #4
0
        static void Main(string[] args)
        {
            // Whole numbers
            int lesson = 1;
            // Floating point numbers
            float  height  = (float)1.5500000000011111111111222222201;
            double height2 = 1.55;
            // Highest precision numbers.
            // Always for money, scientific calculations
            decimal balance = 600005000.000001101011654978m;
            // Text
            string person = "Tom";
            // Conditions: true or false
            bool isFirstLesson = true;



            string greeting1 = Greeter.Greet(person);

            Greeter.Print(person);
            System.Console.ReadLine();

            string prntspellatt = SpellAttributes.Magesfire();

            SpellAttributes.Print(prntspellatt);
            System.Console.ReadLine();
        }
예제 #5
0
 public void ComputeResultingAttributes()
 {
     foreach (var attributeModifier in attributesModifiers)
     {
         resultingAttributes += attributeModifier;
     }
 }
예제 #6
0
        public static bool Has(this Spell spell, SpellAttributes toCheck)
        {
            if (spell == null)
            {
                return(false);
            }

            return((spell.Attributes & toCheck) == toCheck);
        }
예제 #7
0
        public static void FindAllWithAttribute(SpellAttributes attr)
        {
            var query = from spell in SpellHandler.ById
                        where spell != null
                        where spell.Has(attr)
                        select spell;

            foreach (var spell in query)
            {
                Console.WriteLine("{0}: {1} - {2}", spell.Id, spell.Name, spell.Attributes);
                Console.WriteLine();
            }

            Console.WriteLine("{0} spells have Attribute {1}", query.Count(), attr);
        }
예제 #8
0
        public static void FindAllWithAttribute(SpellAttributes attr)
        {
            var query = from spell in SpellHandler.ById
                        where spell != null
                        where spell.Has(attr)
                        select spell;

            foreach (var spell in query)
            {
                Console.WriteLine("{0}: {1} - {2}", spell.Id, spell.Name, spell.Attributes);
                Console.WriteLine();
            }

            Console.WriteLine("{0} spells have Attribute {1}", query.Count(), attr);
        }
예제 #9
0
 public bool HasAttribute(SpellAttributes attribute)
 {
     return((Attributes & attribute) != 0);
 }
예제 #10
0
 public SpellEffect(byte targetId, SpellAttributes spellAttributes)
 {
     targetSelector  = SpellTargetSelector.GetTargetSelector(targetId);
     SpellAttributes = spellAttributes;
 }
예제 #11
0
        private static IEnumerable <UInt64> HandleTargetUnitSelf(Player player, Player enemy, SpellAttributes attributes)
        {
            var card = player.ActiveCard;

            return(card == null ? new List <UInt64>() : new List <UInt64>()
            {
                card.Guid
            });
        }
예제 #12
0
 private static IEnumerable <UInt64> HandleTargetUnitCleaveEnemy(Player player, Player enemy, SpellAttributes attributes) => HandleTargetUnitTargetEnemy(player, enemy, attributes);
예제 #13
0
        private static IEnumerable <UInt64> HandleTargetUnitFriend(Player player, Player enemy, SpellAttributes attributes)
        {
            var query = player.CardDeck.Where(x => x != null);

            if ((attributes & SpellAttributes.TargetExcludeSelf) != SpellAttributes.None)
            {
                query = query.Where(x => x.Guid != player.ActiveCard?.Guid);
            }

            return(query.Select(x => x.Guid));
        }
예제 #14
0
        private static IEnumerable <UInt64> HandleTargetUnitTargetEnemy(Player player, Player enemy, SpellAttributes attributes)
        {
            if ((attributes & SpellAttributes.TargetMelee) == SpellAttributes.None)
            {
                return(enemy.CardDeck.Where(x => x != null).Select(x => x.Guid));
            }

            var card = enemy.CardDeck.ElementAtOrDefault(player.ActiveCardPosition);

            return(card != null ? new List <UInt64>()
            {
                card.Guid
            } : new List <UInt64>());
        }
예제 #15
0
		public static bool HasAnyFlag(this SpellAttributes flags, SpellAttributes otherFlags)
		{
			return (flags & otherFlags) != 0;
		}
예제 #16
0
 public static bool HasAnyFlag(this SpellAttributes flags, SpellAttributes otherFlags)
 {
     return((flags & otherFlags) != SpellAttributes.None);
 }