// 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); }
public static bool Has(this Spell spell, SpellAttributes toCheck) { if (spell == null) return false; return (spell.Attributes & toCheck) == toCheck; }
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; }
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(); }
public void ComputeResultingAttributes() { foreach (var attributeModifier in attributesModifiers) { resultingAttributes += attributeModifier; } }
public static bool Has(this Spell spell, SpellAttributes toCheck) { if (spell == null) { return(false); } return((spell.Attributes & toCheck) == toCheck); }
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); }
public bool HasAttribute(SpellAttributes attribute) { return((Attributes & attribute) != 0); }
public SpellEffect(byte targetId, SpellAttributes spellAttributes) { targetSelector = SpellTargetSelector.GetTargetSelector(targetId); SpellAttributes = spellAttributes; }
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 }); }
private static IEnumerable <UInt64> HandleTargetUnitCleaveEnemy(Player player, Player enemy, SpellAttributes attributes) => HandleTargetUnitTargetEnemy(player, enemy, attributes);
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)); }
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>()); }
public static bool HasAnyFlag(this SpellAttributes flags, SpellAttributes otherFlags) { return (flags & otherFlags) != 0; }
public static bool HasAnyFlag(this SpellAttributes flags, SpellAttributes otherFlags) { return((flags & otherFlags) != SpellAttributes.None); }