public Unit(int x, int y, int level) : base(x, y)
    {
        brain          = new SimpleAI(this);
        Map_position_x = x;
        Map_position_y = y;

        if (level < 0)
        {
            level = 0;
        }

        Max_Health = level - ((float)level) / 1.2f + 1;
        if (Max_Health < 0)
        {
            Max_Health = 1;
        }
        Health = Max_Health;
        Money  = level / 2;
        if (Money < 1)
        {
            Money = 12;
        }
        name = MainColour.ToString() + " unit";

        MainSpell = SpellGenerator.GetInstance().GetClosestSingleSpell(level / 4);
        Debug.Log("enemy hp: " + Max_Health + MainSpell.ToString());
    }
コード例 #2
0
ファイル: Program.cs プロジェクト: duaneking/Tychaia
 private static void HandleGenerateSpell(Random r, int number = 1)
 {
     for (int i = 0; i < number; i++)
     {
         Console.WriteLine(SpellGenerator.Generate(r.Next()));
     }
 }
コード例 #3
0
 public static SpellGenerator GetInstance()
 {
     if (instance == null)
     {
         instance = new SpellGenerator();
     }
     return(instance);
 }
 public Deck()
 {
     for (int i = 0; i < 3; i++)
     {
         this.Add(SpellGenerator.GetInstance().GetClosestSpell(5));
         size++;
     }
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: duaneking/Tychaia
 private static void HandleGenerateSpellbook(Random r)
 {
     Console.WriteLine("Spell book: ");
     for (int i = 0; i < 4; i++)
     {
         Console.WriteLine(" - " + SpellGenerator.Generate(r.Next()));
     }
 }
コード例 #6
0
    public Player() : base()
    {
        spellIndicator      = new SpellIndicator(40);
        PlayerCastIndicator = new CastRangeIndicator();
        spellIndicator.link(PlayerCastIndicator);

        SpellGenerator.GetInstance().PrintAllSpells();
        GameTools.Player = this;
        Money            = 20;
    }
コード例 #7
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        SpellGenerator sg = collision.gameObject.transform.parent.parent.GetComponent <SpellGenerator>();

        if (sg != null && !sg.ownerTag.Equals(this.tag))
        {
            //By using the inheritence of the shape classes, we can get the super class and get information from it.
            AddEffect(collision.gameObject.GetComponent <ShapeAbstractGenerator>().elementalType, collision.gameObject.GetInstanceID());
        }
    }
コード例 #8
0
    public void RefreshStock(Player p)
    {
        int   playerrating = p.CalculateLevel();
        float playermoney  = p.Money;

        SpellStock = new List <Spell>();
        for (int i = 0; i < SpellStockMaxLevel; i++)
        {
            SpellStock.Add(SpellGenerator.GetInstance().GetClosestSpell(playerrating + (i * 2) + ((int)(playermoney / 3.0f))));
        }
    }
コード例 #9
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        SpellGenerator sg = collision.gameObject.transform.parent.parent.GetComponent <SpellGenerator>();

        if (sg != null && !sg.ownerTag.Equals(this.tag))
        {
            if (timeBTWEffectUpdates <= 0)
            {
                switch (collision.tag)
                {
                case "SpellShape":
                    EffectUpdateWithinShapeArea(collision.gameObject.GetInstanceID());
                    break;
                }
                timeBTWEffectUpdates = MaxTimeBTWEffectUpdates;
            }
        }
    }
コード例 #10
0
    public void ReadCode()
    {
        foreach (Transform t in spellParent)
        {
            if (!t.CompareTag("Environment"))
            {
                Destroy(t.gameObject, 0.1f);
            }
        }
        //Interpret the code written by the player
        currentSpellJson = spellInterpreter.InterpretScript(code.text);
        //Turn the json into an actaul spell
        GameObject spellObj = Instantiate <GameObject>(creature.spellGenerator, Vector3.zero, Quaternion.identity);

        spellObj.transform.parent = spellParent;
        currentSpell = spellObj.GetComponent <SpellGenerator>();
        currentSpell.spellSettings = currentSpellJson;
        currentSpell.GenerateSpell(spellObj.transform);
        //HandleTextFile.WriteString(spellBookLocation, JsonUtility.ToJson(spell, true));
    }
コード例 #11
0
    public void LaunchSpell(int nmbr)
    {
        SpellJson currentSpell;

        if (spellGenerator != null)
        {
            switch (nmbr)
            {
            case 0:
                currentSpell = spell1Settings;
                break;

            case 1:
                currentSpell = spell2Settings;
                break;

            default:
                currentSpell = null;
                break;
            }
            if (currentMana >= currentSpell.manaCost && spellReady)
            {
                GameObject spellObj = Instantiate <GameObject>(spellGenerator);

                spellObj.transform.parent = Spells;

                SpellGenerator spellScript = spellObj.GetComponent <SpellGenerator>();
                spellScript.spellSettings = currentSpell;
                spellScript.GenerateSpell(spellDirection);

                spellScript.ownerTag = this.gameObject.tag;
                currentMana         -= currentSpell.manaCost; Vector3 temp = manaBar.transform.localScale;
                temp.x = (currentMana / maxMana) * initScaleXMB;

                manaBar.transform.localScale = temp;
                spellReady = false;
                spellTimer = spellCooldownTime;
            }
        }
    }
コード例 #12
0
ファイル: Program.cs プロジェクト: chroipahtz/RoguelikeSouls
        static void INSTALL(string inputSeed, bool skipAnimRandomizer = false)
        {
            Random random;

            if (inputSeed == "")
            {
                random = new Random();
            }
            else
            {
                random = new Random(inputSeed.GetHashCode());
            }

            if (MOD_PATH == null)
            {
                MOD_PATH = AskForDir();
            }
            else
            {
                Console.WriteLine("\nUse previously-specified game directory? (Y/N)");
                bool yes = ReadKey(ConsoleKey.Y, ConsoleKey.N) == ConsoleKey.Y;
                if (!yes)
                {
                    MOD_PATH = AskForDir();
                }
            }

            if (MOD_PATH == null)
            {
                Console.WriteLine("No EXE selected. Cancelling installation.");
                return;
            }

            DateTime startTime = DateTime.Now;

            Console.WriteLine("\nBeginning installation... This will take about one minute.");
            Console.WriteLine("\n" + SoyPuns.PopRandomElement(random) + "\n");

            SoulsMod mod = new SoulsMod(
                MOD_PATH, ".smbak",
                Resources.GameData.GameParam_parambnd,
                Resources.GameData.paramdef_paramdefbnd,
                Resources.GameData.item_msgbnd,
                Resources.GameData.menu_msgbnd);

            mod.LoadPlayerCharacter();
            mod.LoadNonPlayerCharacters();
            InstallInterrootFolder("event", mod);
            InstallInterrootFolder("map", mod);
            InstallInterrootFolder("script", mod);
            InstallInterrootFolder("sfx", mod);
            InstallInterrootFolder("sound", mod);


            PlayerGenerator playerSetup = new PlayerGenerator(mod);

#if DEBUG
            Console.WriteLine("Running player setup...");
#endif
            playerSetup.Install();
            Thread.CurrentThread.Join(0);

            TextGenerator textSetup = new TextGenerator(mod);
#if DEBUG
            Console.WriteLine("Running text setup...");
#endif
            textSetup.Install();
            Thread.CurrentThread.Join(0);

            SpEffectGenerator spEffectSetup = new SpEffectGenerator(mod);
#if DEBUG
            Console.WriteLine("Running SpEffect setup...");
#endif
            spEffectSetup.Install();
            Thread.CurrentThread.Join(0);

            GoodsGenerator goodsSetup = new GoodsGenerator(mod);
#if DEBUG
            Console.WriteLine("Running goods setup...");
#endif
            goodsSetup.Install();
            Thread.CurrentThread.Join(0);

            SpellGenerator spellSetup = new SpellGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running spell setup...");
#endif
            spellSetup.Install();
            Thread.CurrentThread.Join(0);

            WeaponGenerator weaponSetup = new WeaponGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running weapon setup...");
#endif
            weaponSetup.Install();
            Thread.CurrentThread.Join(0);

            ArmorGenerator armorSetup = new ArmorGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running armor setup...");
#endif
            armorSetup.Install();
            Thread.CurrentThread.Join(0);

            EnemyGenerator enemySetup = new EnemyGenerator(mod, random, weaponSetup, armorSetup);
#if DEBUG
            Console.WriteLine("Running enemy setup...");
#endif
            enemySetup.Install();
            Thread.CurrentThread.Join(0);

            MapItemLotsGenerator itemLotsSetup = new MapItemLotsGenerator(mod, weaponSetup, armorSetup, random);
#if DEBUG
            Console.WriteLine("Running item lot setup...");
#endif
            itemLotsSetup.Install();
            Thread.CurrentThread.Join(0);

            EnemyAnimationGenerator animSetup = new EnemyAnimationGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running animation setup...");
#endif
            animSetup.Install(skipAnimRandomizer);
            Thread.CurrentThread.Join(0);

            // Must be run AFTER weapon/armor setup.
            CharacterGenerator chrSetup = new CharacterGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running chr setup...");
#endif
            chrSetup.Install();
            Thread.CurrentThread.Join(0);

            Console.WriteLine(SoyPuns.PopRandomElement(random) + "\n");

#if DEBUG
            Console.WriteLine("Installing mod...");
#endif
            mod.Install();
            Thread.CurrentThread.Join(0);

#if DEBUG
            Console.WriteLine($"Installation time: {(DateTime.Now - startTime).TotalSeconds}");
#endif
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: Grimrukh/RoguelikeSouls
        static void INSTALL(string inputSeed)
        {
            Random random;

            random = inputSeed == "" ? new Random() : new Random(inputSeed.GetHashCode());

            MOD_PATH = GetGameDir();
            if (MOD_PATH == null)
            {
                Console.WriteLine("No EXE selected. Cancelling installation.");
                return;
            }

            DateTime startTime = DateTime.Now;

            Console.WriteLine("\nBeginning installation... This will take about one minute.");
            Console.WriteLine("\n" + SoyPuns.PopRandomElement(random) + "\n");

            SoulsMod mod = new SoulsMod(
                MOD_PATH, ".rsbak",
                Resources.GameData.GameParam_parambnd,
                Resources.GameData.paramdef_paramdefbnd,
                Resources.GameData.item_msgbnd,
                Resources.GameData.menu_msgbnd);

            mod.LoadPlayerCharacter();
            mod.LoadNonPlayerCharacters();
            InstallInterrootFolder("event", mod);
            InstallInterrootFolder("map", mod);
            InstallInterrootFolder("script", mod);
            InstallInterrootFolder("sfx", mod);
            InstallInterrootFolder("sound", mod);

            TextGenerator textSetup = new TextGenerator(mod);

#if DEBUG
            Console.WriteLine("Running text setup...");
#else
            Console.WriteLine("Studying the ancient texts...");
#endif
            textSetup.Install();
            Thread.CurrentThread.Join(0);

            PlayerGenerator playerSetup = new PlayerGenerator(mod);
#if DEBUG
            Console.WriteLine("Running player setup...");
#else
            Console.WriteLine("Putting the party together...");
#endif
            playerSetup.Install();
            Thread.CurrentThread.Join(0);

            SpEffectGenerator spEffectSetup = new SpEffectGenerator(mod);
#if DEBUG
            Console.WriteLine("Running SpEffect setup...");
#else
            Console.WriteLine("Channeling the powers that be...");
#endif
            spEffectSetup.Install();
            Thread.CurrentThread.Join(0);

            GoodsGenerator goodsSetup = new GoodsGenerator(mod);
#if DEBUG
            Console.WriteLine("Running goods setup...");
#else
            Console.WriteLine("Documenting the artifacts...");
#endif
            goodsSetup.Install();
            Thread.CurrentThread.Join(0);

            SpellGenerator spellSetup = new SpellGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running spell setup...");
#else
            Console.WriteLine("Messing with forces beyond our control...");
#endif
            spellSetup.Install();
            Thread.CurrentThread.Join(0);

            WeaponGenerator weaponSetup = new WeaponGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running weapon setup...");
#else
            Console.WriteLine("Spinning up the whetstone...");
#endif
#if SKIP_BEHAVIORS
            Console.WriteLine("WARNING: Skipping weapon behaviors/attacks!");
            weaponSetup.SkipBehaviors = true;
#endif
            weaponSetup.Install();
            Thread.CurrentThread.Join(0);

            ArmorGenerator armorSetup = new ArmorGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running armor setup...");
#else
            Console.WriteLine("Polishing the armor...");
#endif
            armorSetup.Install();
            Thread.CurrentThread.Join(0);

            EnemyGenerator enemySetup = new EnemyGenerator(mod, random, weaponSetup, armorSetup);
#if DEBUG
            Console.WriteLine("Running enemy setup...");
#else
            Console.WriteLine("Opening the bestiary...");
#endif
            enemySetup.Install();
            Thread.CurrentThread.Join(0);

            EnemyAnimationGenerator animSetup = new EnemyAnimationGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Modifying enemy animations...");
#else
            Console.WriteLine("Rousing the rabble...");
#endif
            animSetup.Install();
            Thread.CurrentThread.Join(0);

            MapItemLotsGenerator itemLotsSetup = new MapItemLotsGenerator(mod, weaponSetup, armorSetup, random);
#if DEBUG
            Console.WriteLine("Running item lot setup...");
#else
            Console.WriteLine("Burying the treasures...");
#endif
            itemLotsSetup.Install();
            Thread.CurrentThread.Join(0);

            // Must be run AFTER weapon/armor setup.
            CharacterGenerator chrSetup = new CharacterGenerator(mod, random);
#if DEBUG
            Console.WriteLine("Running character setup...");
#else
            Console.WriteLine("Assembling the party...");
#endif
            chrSetup.Install();
            Thread.CurrentThread.Join(0);

#if DEBUG
            Console.WriteLine("Installing mod...");
#else
            Console.WriteLine("Heading forth...");
#endif
            mod.Install();
            Thread.CurrentThread.Join(0);

            Console.WriteLine("\nInstallation successful! Press ENTER to return to the prompt.");
#if DEBUG
            Console.WriteLine($"Installation time: {(DateTime.Now - startTime).TotalSeconds} seconds");
#endif
            Console.ReadLine();
        }