Пример #1
0
 public void CanEquipSpellBook()
 {
     var inventory = new Inventory();
     var spellBook = new SpellBook { Name = "hello" };
     inventory.Add(spellBook);
     Assert.Contains(spellBook, inventory.AllItems);
     Assert.Contains(spellBook, inventory.UnequippedItems);
     Assert.DoesNotContain(spellBook, inventory.EquippedItems);
     Assert.Null(inventory.SpellBookItem);
     inventory.Equip(spellBook);
     Assert.Contains(spellBook, inventory.AllItems);
     Assert.DoesNotContain(spellBook, inventory.UnequippedItems);
     Assert.Contains(spellBook, inventory.EquippedItems);
     Assert.Same(spellBook, inventory.SpellBookItem);
 }
Пример #2
0
    public static void castSpell(SpellBook spellBook, Vector3 position, Quaternion rotation)
    {
        Object prefab = instance.fireBall;
        SpellType spellType = SpellType.Damage;

        switch (spellBook) {
            case SpellBook.FireBall:
                prefab = instance.fireBall;
                spellType = SpellType.Damage;
                break;
            case SpellBook.IceBlitz:
                prefab = instance.iceBlitz;
                spellType = SpellType.Damage;
                break;
        }

        Vector3 offset = rotation * Vector3.forward * GameManager.TileSize / 2f;
        var o = Object.Instantiate(prefab, position + offset, rotation) as GameObject;
        Spell spell = o.GetComponent<Spell>();
        spell.Initialize(spellType);
    }
Пример #3
0
    public Enemy()
    {
        Player_Name = "Warlock";
        Players_Summon = new Summon("Golem", 1, 0, 120, 10, 20, Summon.Type.EARTH);
        Player_Spell_Book = new SpellBook();

        // instead of having a spell book I want the enemy
        // to have 2 different lists of spells
        // Attack spells and defense spells
        attack_spells = new List<BaseSpell>();
        attack_spells.Add (new FireStrike());
        attack_spells.Add (new FireStrike());
        attack_spells.Add (new PoisonStrike());
        attack_spells.Add (new PoisonStrike());
        attack_spells.Add (new DarkStrike());
        attack_spells.Add (new DarkStrike());

        defense_spells = new List<BaseSpell>();
        defense_spells.Add (new PoisonShield());
        defense_spells.Add (new PoisonShield());
        defense_spells.Add (new FireShield());
        defense_spells.Add (new FireShield());
    }
Пример #4
0
 public override Spell[] GetSpellsTier2()
 {
     return(new Spell[] { SpellBook.get("elemental:descend") });
 }
Пример #5
0
 void Awake()
 {
     theSpellBook = gameObject.GetComponent<SpellBook>();
 }
Пример #6
0
 protected Spell CastOnLeastTarget(SpellBook spellToCast, Func <Character, int> sorter)
 {
     return(CastOnLeastTarget(spellToCast, sorter, DEFAULT_SPELL));
 }
Пример #7
0
 private static string CreateDetailedTargetName(Character owner, Character target, SpellBook sb)
 {
     return(Util.ColorString(target.Look.DisplayName, sb.IsCastable(owner, target)));
 }
Пример #8
0
 public virtual void setup(SpellBook spellBook)
 {
 }
Пример #9
0
 /// <summary>
 /// Release charged spell that has cast time
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="screenPosition"></param>
 /// <param name="castTime"></param>
 public static bool ReleaseChargeSpell(SpellCastSlot slot, Vector2 screenPosition, float castTime)
 {
     return(SpellBook.ReleaseChargeSpell(slot, screenPosition, castTime));
 }
Пример #10
0
 /// <summary>
 /// Casts a spell at/towards the given vector2 position parameter.
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="screenPosition"></param>
 public static bool CastSpell(CastSlot slot, Vector2 screenPosition)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, screenPosition));
 }
Пример #11
0
 /// <summary>
 /// Casts a spell at/towards the position of the mouse.
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="castTime"></param>
 public static bool CastSpell(CastSlot slot, float castTime)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, castTime));
 }
Пример #12
0
 /// <summary>
 /// Release charged spell
 /// </summary>
 /// <param name="slot"></param>
 public static bool ReleaseChargeSpell(SpellCastSlot slot)
 {
     return(SpellBook.ReleaseChargeSpell(slot));
 }
Пример #13
0
 public override Spell[] GetSpellsTier1()
 {
     return(new Spell[] { SpellBook.get("elemental:fireball"), SpellBook.get("elemental:frostbolt") });
 }
Пример #14
0
 /// <summary>
 /// Casts a spell at/towards the given vector2 position parameter.
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="screenPosition"></param>
 /// <param name="castTime"></param>
 public static bool CastSpell(CastSlot slot, Vector2 screenPosition, float castTime)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, screenPosition, castTime));
 }
Пример #15
0
 public bool IsReady()
 {
     return(SpellBook.CanUseSpell(Slot) == SpellState.Ready);
 }
Пример #16
0
 public void selectSpell(string spellname)
 {
     if (spellname.Equals("fireball")) {
         selectedSpell = SpellBook.FireBall;
         UI_img_frostbolt_selected.enabled = false;
         UI_img_fireball_selected.enabled = true;
         manaCost = 10;
         //UI_img_frostbolt.enabled = true;
     }
     if (spellname.Equals("iceblitz")) {
         selectedSpell = SpellBook.IceBlitz;
         UI_img_frostbolt_selected.enabled = true;
         UI_img_fireball_selected.enabled = false;
         manaCost = 10;
         //UI_img_fireball.enabled = true;
     }
 }
Пример #17
0
 public override void Pack(BinaryWriter writer)
 {
     writer.Write(ObjectID);
     writer.Write(Flags);
     writer.WriteBool32(Success);
     if ((Flags & 0x00000001) != 0)
     {
         IntStatsTable.Pack(writer);
     }
     if ((Flags & 0x00002000) != 0)
     {
         Int64StatsTable.Pack(writer);
     }
     if ((Flags & 0x00000002) != 0)
     {
         BoolStatsTable.Pack(writer);
     }
     if ((Flags & 0x00000004) != 0)
     {
         FloatStatsTable.Pack(writer);
     }
     if ((Flags & 0x00000008) != 0)
     {
         StrStatsTable.Pack(writer);
     }
     if ((Flags & 0x00001000) != 0)
     {
         DidStatsTable.Pack(writer);
     }
     if ((Flags & 0x00000010) != 0)
     {
         SpellBook.Pack(writer);
     }
     if ((Flags & 0x00000080) != 0)
     {
         ArmorProfile.Pack(writer);
     }
     if ((Flags & 0x00000100) != 0)
     {
         CreatureProfile.Pack(writer);
     }
     if ((Flags & 0x00000020) != 0)
     {
         WeaponProfile.Pack(writer);
     }
     if ((Flags & 0x00000040) != 0)
     {
         HookAppraisalProfile.Pack(writer);
     }
     if ((Flags & 0x00000200) != 0)
     {
         writer.Write((ushort)ProtHighlight);
         writer.Write((ushort)ProtColor);
     }
     if ((Flags & 0x00000800) != 0)
     {
         writer.Write((ushort)WeapHighlight);
         writer.Write((ushort)WeapColor);
     }
     if ((Flags & 0x00000400) != 0)
     {
         writer.Write((ushort)ResistHighlight);
         writer.Write((ushort)ResistColor);
     }
     if ((Flags & 0x00004000) != 0)
     {
         writer.Write(BaseArmorHead);
         writer.Write(BaseArmorChest);
         writer.Write(BaseArmorGroin);
         writer.Write(BaseArmorBicep);
         writer.Write(BaseArmorWrist);
         writer.Write(BaseArmorHand);
         writer.Write(BaseArmorThigh);
         writer.Write(BaseArmorShin);
         writer.Write(BaseArmorFoot);
     }
 }
Пример #18
0
 public override void Unpack(BinaryReader reader)
 {
     base.Unpack(reader);
     ObjectID = reader.ReadUInt32();
     Flags    = reader.ReadUInt32();
     Success  = reader.ReadBool32();
     if ((Flags & 0x00000001) != 0)
     {
         IntStatsTable.Unpack(reader);
     }
     if ((Flags & 0x00002000) != 0)
     {
         Int64StatsTable.Unpack(reader);
     }
     if ((Flags & 0x00000002) != 0)
     {
         BoolStatsTable.Unpack(reader);
     }
     if ((Flags & 0x00000004) != 0)
     {
         FloatStatsTable.Unpack(reader);
     }
     if ((Flags & 0x00000008) != 0)
     {
         StrStatsTable.Unpack(reader);
     }
     if ((Flags & 0x00001000) != 0)
     {
         DidStatsTable.Unpack(reader);
     }
     if ((Flags & 0x00000010) != 0)
     {
         SpellBook.Unpack(reader);
     }
     if ((Flags & 0x00000080) != 0)
     {
         ArmorProfile.Unpack(reader);
     }
     if ((Flags & 0x00000100) != 0)
     {
         CreatureProfile.Unpack(reader);
     }
     if ((Flags & 0x00000020) != 0)
     {
         WeaponProfile.Unpack(reader);
     }
     if ((Flags & 0x00000040) != 0)
     {
         HookAppraisalProfile.Unpack(reader);
     }
     if ((Flags & 0x00000200) != 0)
     {
         ProtHighlight = (ArmorHighlightMask)reader.ReadUInt16();
         ProtColor     = (ArmorHighlightMask)reader.ReadUInt16();
     }
     if ((Flags & 0x00000800) != 0)
     {
         WeapHighlight = (WeaponHighlightMask)reader.ReadUInt16();
         WeapColor     = (WeaponHighlightMask)reader.ReadUInt16();
     }
     if ((Flags & 0x00000400) != 0)
     {
         ResistHighlight = (ResistHighlightMask)reader.ReadUInt16();
         ResistColor     = (ResistHighlightMask)reader.ReadUInt16();
     }
     if ((Flags & 0x00004000) != 0)
     {
         BaseArmorHead  = reader.ReadUInt32();
         BaseArmorChest = reader.ReadUInt32();
         BaseArmorGroin = reader.ReadUInt32();
         BaseArmorBicep = reader.ReadUInt32();
         BaseArmorWrist = reader.ReadUInt32();
         BaseArmorHand  = reader.ReadUInt32();
         BaseArmorThigh = reader.ReadUInt32();
         BaseArmorShin  = reader.ReadUInt32();
         BaseArmorFoot  = reader.ReadUInt32();
     }
 }
Пример #19
0
 public override Spell[] GetSpellsTier3()
 {
     return(new Spell[] { SpellBook.get("toil:blink") });
 }
Пример #20
0
 /// <summary>
 /// Casts a spell at/towards the position of the mouse.
 /// </summary>
 /// <param name="slot"></param>
 public static bool CastSpell(CastSlot slot)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot));
 }
Пример #21
0
 public override Spell[] GetSpellsTier3()
 {
     return(new Spell[] { SpellBook.get("elemental:teleport") });
 }
Пример #22
0
 /// <summary>
 /// Start charging spell
 /// </summary>
 /// <param name="slot"></param>
 public static bool StartChargeSpell(SpellCastSlot slot)
 {
     return(SpellBook.StartChargeSpell(slot));
 }
Пример #23
0
 public override Spell[] GetSpellsTier1()
 {
     return(new Spell[] { SpellBook.get("nature:lantern"), SpellBook.get("nature:tendrils") });
 }
Пример #24
0
 /// <summary>
 /// Release charged spell that has cast time
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="castTime"></param>
 public static bool ReleaseChargeSpell(SpellCastSlot slot, float castTime)
 {
     return(SpellBook.ReleaseChargeSpell(slot, castTime));
 }
Пример #25
0
 public override Spell[] GetSpellsTier2()
 {
     return(new Spell[] { SpellBook.get("nature:shockwave") });
 }
Пример #26
0
 /// <summary>
 /// Casts a spell at/towards the given vector3 position parameter
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="objectPosition"></param>
 public static bool CastSpell(CastSlot slot, Vector3 objectPosition)
 {
     return(SpellBook.CastSpell((SpellCastSlot)slot, objectPosition));
 }
Пример #27
0
 public override Spell[] GetSpellsTier3()
 {
     return(new Spell[] { SpellBook.get("nature:photosynthesis") });
 }
Пример #28
0
 private void AddTempSpell(SpellBook temporary)
 {
     Util.Assert(!temporary.HasFlag(Spells.Flag.CASTER_REQUIRES_SPELL), "Has flag: Caster req spell.");
     temporarySpells.Add(temporary);
 }
Пример #29
0
 public override Spell[] GetSpellsTier1()
 {
     return(new Spell[] { SpellBook.get("arcane:analyze"), SpellBook.get("arcane:magicmissle") });
 }
Пример #30
0
 private static Process GenerateTargetProcess(Page current, IButtonable previous, Character owner, Character target, SpellBook sb, Action <IPlayable> handlePlayable)
 {
     return(GenerateTargetProcessHelper(current, previous, owner, target, sb, handlePlayable, CreateDetailedTargetName(owner, target, sb), target.Look.Sprite));
 }
Пример #31
0
 public override Spell[] GetSpellsTier2()
 {
     return(new Spell[] { SpellBook.get("arcane:disenchant"), SpellBook.get("arcane:enchant") });
 }
Пример #32
0
        static void Main(string[] args)
        {
            Shield shield = new Shield("Golden Shield", 75, "Escudo Protector");
            Sword  sword  = new Sword("Katana", 125, "Corte Fugaz");

            Orc orc = new Orc("Grom", 25, "Tanque");

            orc.Equip(sword);
            orc.Equip(shield);


            Axe       axe       = new Axe("Verdugo", 70, "Juicio final");
            Warhammer warhammer = new Warhammer("Mjölnir", 90, "Aplastar y machacar");

            Dwarf dwarf = new Dwarf("Thorin", 35, "Luchador");

            dwarf.Equip(axe);
            dwarf.Equip(warhammer);

            Bow   bow   = new Bow("Arco gigante", 75, "Tira fuego");
            Cloak cloak = new Cloak("Capa maxima", 85, "Invisibilidad");

            Elf elf = new Elf("Galardiel", 15, "Escurridizo");

            elf.Equip(bow);
            elf.Equip(cloak);

            SpellBook  spellBook  = new SpellBook("Libro de Hechizos Oscuros", "Hechizos oscuros");
            Spell      spell      = new Spell("Lumos", "La varita enciende luz", 65, 0);
            MagicStaff magicStaff = new MagicStaff("Baculo Oscuro", 150, "Baculo perdido de Toran");

            Wizard wizard = new Wizard("Harry", "Mago De Apoyo", spellBook);

            dwarf.Attack(orc);
            Console.WriteLine("👳 " + dwarf.Name + " cura a 🤢 " + orc.Name);
            dwarf.HealCharacter(orc);
            Console.WriteLine();

            orc.Attack(wizard);
            wizard.Respawn();
            Console.WriteLine(wizard.Name + " ha respawneado");
            Console.WriteLine("La vida actual de 🧙 " + wizard.Name + " ahora es: " + wizard.Health + " ❤");
            Console.WriteLine();

            elf.UnEquip(bow);
            elf.Equip(sword);
            Console.WriteLine("El daño total que causa 🧝‍♀️ " + elf.Name + " es: " + elf.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🧝‍♀️ " + elf.Name + " es: " + elf.TotalProtection() + " 🛡");
            Console.WriteLine();

            orc.UnEquip(sword);
            orc.Equip(axe);
            Console.WriteLine("El daño total que causa 🤢 " + orc.Name + " es: " + orc.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🤢 " + orc.Name + " es: " + orc.TotalProtection() + " 🛡");
            Console.WriteLine();

            dwarf.UnEquip(axe);
            dwarf.Equip(shield);
            Console.WriteLine("El daño total que causa 👳 " + dwarf.Name + " es: " + dwarf.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 👳 " + dwarf.Name + " es: " + dwarf.TotalProtection() + " 🛡");
            Console.WriteLine();

            wizard.Equip(magicStaff);
            wizard.Equip(spellBook);
            wizard.LearnSpell(spell);
            Console.WriteLine();

            Console.WriteLine("El daño total que causa 🧙 " + wizard.Name + " es: " + wizard.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🧙 " + wizard.Name + " es: " + wizard.TotalProtection() + " 🛡");
            Console.WriteLine();

            wizard.UnEquip(magicStaff);
            Console.WriteLine();
            wizard.Equip(sword);
            wizard.Equip(shield);
            Console.WriteLine("Se añadieron los items: " + sword.Name + " y " + shield.Name + " al inventario de " + wizard.Name);
            Console.WriteLine("El daño total que causa 🧙 " + wizard.Name + " ahora es: " + wizard.TotalDamage() + " 🗡");
            Console.WriteLine("La protección total de 🧙 " + wizard.Name + " ahora es: " + wizard.TotalProtection() + " 🛡");
        }
Пример #33
0
 public override Spell[] GetSpellsTier3()
 {
     return(new Spell[] { SpellBook.get("arcane:rewind") });
 }
Пример #34
0
 private Spell GetSpellOrDefault(Character specificTarget, SpellBook spellToCast, SpellBook defaultSpell)
 {
     // If spell is not castable, default to waiting.
     if (specificTarget != null)
     {
         SpellBook castableSpell = null;
         if (spellToCast.IsCastable(brainOwner, new Character[] { specificTarget }))
         {
             castableSpell = spellToCast;
         }
         else
         {
             castableSpell = defaultSpell;
         }
         if (castableSpell != null)
         {
             return(brainOwner.Spells.CreateSpell(currentBattle, spellToCast, brainOwner, specificTarget));
         }
     }
     return(brainOwner.Spells.CreateSpell(currentBattle, defaultSpell, brainOwner, brainOwner));
 }
Пример #35
0
        private bool LoadProfile(string fileName, bool reloadUI = true)
        {
            using (var sr = new StreamReader(fileName))
            {
                var code = sr.ReadToEnd();

                Log.Write($"Loading file [{fileName}]...", Color.Black);

                //if (fileName.EndsWith(".enc"))
                //{
                //    Log.Write("Decrypting profile...", Color.Black);

                //    try
                //    {
                //        code = Encryption.Decrypt(code);

                //        Log.Write("Profile has been decrypted successfully", Color.Green);
                //    }
                //    catch (Exception ex)
                //    {
                //        Log.Write(ex.Message, Color.Red);
                //    }
                //}

                if (code.Trim() == "")
                {
                    MessageBox.Show("Please select a non blank file", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                if (code.ToLower().Contains("class detectkeypress"))
                {
                    MessageBox.Show("DetectKeyPress is already built into CloudMagic, please dont re-create the wheel.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                if (code.ToLower().Contains("wow.speak("))
                {
                    MessageBox.Show("WoW.Speak() is no longer allowed in custom rotations.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                //if (code.Contains("System.IO"))
                //{
                //    MessageBox.Show("using System.IO; is no longer allowed in custom rotations, no IO is needed other than Config Saving which you can already do.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    return false;
                //}

                Log.Write($"Compiling file [{fileName}]...", Color.Black);

                var provider   = new CSharpCodeProvider();
                var parameters = new CompilerParameters();

                parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");
                parameters.ReferencedAssemblies.Add("System.Drawing.dll");
                parameters.ReferencedAssemblies.Add("System.Data.dll");
                parameters.ReferencedAssemblies.Add("System.Xml.dll");
                parameters.ReferencedAssemblies.Add("System.Linq.dll");
                parameters.ReferencedAssemblies.Add("System.dll");
                parameters.ReferencedAssemblies.Add("System.IO.dll");
                parameters.ReferencedAssemblies.Add("System.Core.dll");
                parameters.ReferencedAssemblies.Add("System.Threading.dll");
                parameters.ReferencedAssemblies.Add(Application.ExecutablePath);
                parameters.GenerateInMemory   = true;
                parameters.GenerateExecutable = false;

                var results = provider.CompileAssemblyFromSource(parameters, code);

                if (results.Errors.HasErrors)
                {
                    foreach (CompilerError error in results.Errors)
                    {
                        Log.Write($"Error on line [{error.Line}] - ({error.ErrorNumber}): {error.ErrorText}", Color.Red);
                    }

                    return(false);
                }

                var assembly = results.CompiledAssembly;

                foreach (var t in assembly.GetTypes())
                {
                    if (t.IsClass)
                    {
                        var obj = Activator.CreateInstance(t);
                        combatRoutine = (CombatRoutine)obj;

                        combatRoutine.Load(this);
                        combatRoutine.FileName = fileName;

                        Log.Write("Successfully loaded combat routine: " + combatRoutine.Name, Color.Green);

                        if (SpellBook.Initialize(fileName, reloadUI))
                        {
                            spellbookToolStripMenuItem.Enabled = true;

                            cmdStartBot.Enabled            = true;
                            cmdStartBot.BackColor          = Color.LightGreen;
                            cmdRotationSettings.Enabled    = true;
                            cmdReloadRotation.Enabled      = true;
                            cmdReloadRotationAndUI.Enabled = true;

                            return(true);
                        }

                        spellbookToolStripMenuItem.Enabled = false;

                        cmdStartBot.Enabled   = false;
                        cmdStartBot.BackColor = Color.WhiteSmoke;
                        return(false);
                    }
                }

                return(false);
            }
        }
Пример #36
0
 // Use this for initialization
 void Start()
 {
     starter_book = new SpellBook();
     Setup_Starter_Books();
     starter_inventory = new SpellInventory();
     Setup_Starter_Inventory();
     warning_font_size = (int)(Screen.width * 0.014f);
     font_size = (int)(Screen.width * 0.02f);
     character_name_field.GetComponentsInChildren<Text>()[0].fontSize = font_size;
     character_name_field.GetComponentsInChildren<Text>()[1].fontSize = font_size;
     choose_summon_title.GetComponentsInChildren<Text>()[0].fontSize = font_size;
     vampire_toggle.GetComponentsInChildren<Text>()[0].fontSize = font_size;
     paladin_toggle.GetComponentsInChildren<Text>()[0].fontSize = font_size;
     phoenix_toggle.GetComponentsInChildren<Text>()[0].fontSize = font_size;
     golem_toggle.GetComponentsInChildren<Text>()[0].fontSize = font_size;
     create_button.GetComponentsInChildren<Text>()[0].fontSize = font_size;
     warning_text.GetComponent<Text>().fontSize = warning_font_size;
     warning_text.SetActive(false);
     summon_description.GetComponent<Text>().fontSize = font_size;
 }
Пример #37
0
 void Awake()
 {
     m_instance = this;
 }