Example #1
0
        public static async Task Search(CommandContext bc)
        {
            if (bc.MessageTokens.Length == 1)
            {
                await bc.SendReply("Syntax: !MonsterSearch <search terms>");
                return;
            }

            // get search terms
            string search_terms = bc.MessageTokens.Join(1);

            var results = new Monsters(search_terms);

            if (results.Count > 0)
            {
                var reply = @"\c12www.zybez.net\c found \c07{0}\c results:".FormatWith(results.Count);
                for (int i = 0; i < Math.Min(15, results.Count); i++)
                {
                    reply += @" \c07{0}\c ({1});".FormatWith(results[i].Name, results[i].Level);
                }
                await bc.SendReply(reply);
            }
            else
            {
                await bc.SendReply(@"\c12www.zybez.net\c doesn't have any record for '{0}'.", search_terms);
            }
        }
Example #2
0
 public Area(string name, string image, List<BasicGeoposition> positionList, List<Model.Item> itemList, Monsters.MonsterList monsterList)
     : this(name, image, positionList, itemList)
 {
     MonsterList = monsterList;
 }
Example #3
0
        public static async Task Info(CommandContext bc)
        {
            if (bc.MessageTokens.Length == 1)
            {
                await bc.SendReply("Syntax: !MonsterInfo <monster>");
                return;
            }

            // get search terms
            string search_terms = bc.MessageTokens.Join(1);

            // get level
            int level = 0;
            Match M = Regex.Match(search_terms, "\\((\\d+)\\)");
            if (M.Success)
            {
                level = int.Parse(M.Groups[1].Value, CultureInfo.InvariantCulture);
                search_terms = Regex.Replace(search_terms, "\\((\\d+)\\)", string.Empty).Trim();
            }

            var results = new Monsters(search_terms);

            if (results.Count > 0)
            {
                Monster monster = null;
                if (level > 0)
                {
                    // search for exact match at name and level
                    foreach (Monster m in results)
                    {
                        if (m.Name.ToUpperInvariant() == search_terms.ToUpperInvariant() && m.Level == level)
                        {
                            monster = m;
                            break;
                        }
                    }

                    // search for partial match at name and level
                    if (monster == null)
                    {
                        foreach (Monster m in results)
                        {
                            if (m.Name.ContainsI(search_terms) && m.Level == level)
                            {
                                monster = m;
                                break;
                            }
                        }
                    }
                }

                // search for exact match at name
                if (monster == null)
                {
                    foreach (Monster m in results)
                    {
                        if (m.Name.ToUpperInvariant() == search_terms.ToUpperInvariant())
                        {
                            monster = m;
                            break;
                        }
                    }
                }

                // search for partial match at name
                if (monster == null)
                {
                    foreach (Monster m in results)
                    {
                        if (m.Name.ContainsI(search_terms))
                        {
                            monster = m;
                            break;
                        }
                    }
                }

                if (monster == null)
                {
                    await bc.SendReply(@"\c12www.zybez.net\c doesn't have any record for '{0}'.", search_terms);
                }
                else
                {
                    monster.Update();
                    await bc.SendReply(@"Name: \c07{0}\c | Level: \c07{1}\c | Life points: \c07{2}\c | Examine: \c07{3}\c | \c12www.zybez.net/npc.aspx?id={4}\c", monster.Name, monster.Level, monster.Hits, monster.Examine, monster.Id);
                    await bc.SendReply(@"Aggressive? \c{0}\c | Members? \c{1}\c | Habitat: \c07{2}\c", monster.Aggressive ? "3Yes" : "4No", monster.Members ? "3Yes" : "4No", monster.Habitat);
                }
            }
            else
            {
                await bc.SendReply(@"\c12www.zybez.net\c doesn't have any record for '{0}'.", search_terms);
            }
        }
Example #4
0
        private static bool _GetMonster(string input_monster, out string monster_name, out int monster_hp)
        {
            // get level
            int level = 0;
            Match M = Regex.Match(input_monster, "\\((\\d+)\\)");
            if (M.Success)
            {
                level = int.Parse(M.Groups[1].Value, CultureInfo.InvariantCulture);
                input_monster = Regex.Replace(input_monster, "\\((\\d+)\\)", string.Empty).Trim();
            }

            var results = new Monsters(input_monster);

            if (results.Count > 0)
            {
                Monster monster = null;
                if (level > 0)
                {
                    // search for exact match at name and level
                    foreach (Monster m in results)
                    {
                        if (m.Name.ToUpperInvariant() == input_monster.ToUpperInvariant() && m.Level == level)
                        {
                            monster = m;
                            break;
                        }
                    }

                    // search for partial match at name and level
                    if (monster == null)
                    {
                        foreach (Monster m in results)
                        {
                            if (m.Name.ContainsI(input_monster) && m.Level == level)
                            {
                                monster = m;
                                break;
                            }
                        }
                    }
                }

                // search for exact match at name
                if (monster == null)
                {
                    foreach (Monster m in results)
                    {
                        if (m.Name.ToUpperInvariant() == input_monster.ToUpperInvariant())
                        {
                            monster = m;
                            break;
                        }
                    }
                }

                // search for partial match at name
                if (monster == null)
                {
                    foreach (Monster m in results)
                    {
                        if (m.Name.ContainsI(input_monster))
                        {
                            monster = m;
                            break;
                        }
                    }
                }

                if (monster != null)
                {
                    monster.Update();
                    monster_name = monster.Name;
                    monster_hp = monster.Hits;
                    return true;
                }
            }

            monster_name = null;
            monster_hp = 0;
            return false;
        }
Example #5
0
 //initilisation before starting the game
 void Awake()
 {
     stat = Player.GetComponent<PStats>();
     Enemy = All_Enemy[Random.Range (0, All_Enemy.Length)];
     OurEnemy = (GameObject) Instantiate(Enemy,new Vector2(-1.22f, 0), Quaternion.identity);
     enem_stat = OurEnemy.GetComponent<Monsters> ();
     if (!PlayerPrefs.HasKey("init")) {
         PlayerPrefs.SetInt ("STR", stat.Player.STR);
         PlayerPrefs.SetInt ("AGI", stat.Player.AGI);
         PlayerPrefs.SetInt ("INT", stat.Player.INT);
         PlayerPrefs.SetInt ("init", 1);
     }
     stat.StatUpdate ();
     enem_stat.StatUpdate ();
 }
Example #6
0
 public void RegisterMonster(Func <IDeepWoodsLocation, Vector2, bool> decisionCallback, Func <Monster> creationCallback)
 {
     Monsters.Add(Tuple.Create(decisionCallback, creationCallback));
 }
Example #7
0
 public Monster GetMonsterAt(int x, int y)
 {
     return(Monsters.FirstOrDefault(m => m.X == x && m.Y == y));
 }
Example #8
0
    public void Fight()
    {
        if (reallyHasEnemy)
        {
            animator.SetFloat("moveX", -1);
            animator.SetFloat("moveY", 0);
            animator.SetBool("attacking", true);
            attacking = true;
            TurnOffFight();
            //fight.SetActive(false);
            Debug.Log("Fighting");

            HealthbarController hbController = healthbar_fg.GetComponent <HealthbarController>();
            Character           character    = player.GetComponent <Character>();
            Monsters            monster      = enemy.GetComponent <Monsters>();
            if (character.curHP >= 0)
            {
                // Monsters monster = enemy.GetComponent<Monsters>();
                // Character character = player.GetComponent<Character>();
                CalculateDmgEnemy(monster);
                CalculateDmgPlayer(character);
                if (character.curHP - enemyDmg <= 0 || monster.curHP - playerDmg <= 0)
                {
                    animatorE.SetBool("attacking", false);

                    dialogActive = true;
                    TurnOffFight();
                    enemy.SetActive(false);
                    dialogActive = true;
                    dialogBox.SetActive(true);
                    dialog          = "You have defeated the log!";
                    dialogText.text = dialog;
                    turnFinished    = true;
                    afterFightN     = true;
                }
                else
                {
                    Debug.Log("player:" + playerDmg.ToString());
                    Debug.Log("enemy:" + enemyDmg.ToString());
                    character.curHP -= enemyDmg;
                    hbController.onTakeDmg(enemyDmg);

                    monster.curHP -= playerDmg;

                    Debug.Log("player HP:" + character.curHP.ToString());
                    Debug.Log("enemy HP:" + monster.curHP.ToString());
                }
            }
        }

        // if (monster.curHP <= 0)
        // {
        //     dialogActive = true;
        //     dialogBox.SetActive(true);
        //     dialog = "You have defeated the log!";
        //     dialogText.text = dialog;

        //     afterFightN = true;

        // }
    }
Example #9
0
 void CalculateDmgEnemy(Monsters e1)
 {
     enemyDmg = e1.str + e1.dex + e1.intel;
 }
Example #10
0
 public SpawnMonster(Monsters self)
 {
     this.self = self;
 }
Example #11
0
 public RegisterMonster(Monsters self)
 {
     this.self = self;
 }
Example #12
0
 public string GenerateRsfn(bool isInit = false)
 {
     return(MapInstanceType == MapInstanceType.TimeSpaceInstance ? $"rsfn {MapIndexX} {MapIndexY} {(isInit ? 1 : (Monsters.Where(s => s.IsAlive).ToList().Count == 0 ? 0 : 1))}" : string.Empty);
 }
Example #13
0
        static void Main(string[] args)
        {
            var manager = new FileManager(@"C:\Hellgate");

            manager.BeginAllDatReadAccess();
            manager.LoadTableFiles();
            manager.EndAllDatAccess();

            //TODO: hp/power regen is messed up when displaying the full formula because I guess the itemdisplay formula isn't used

            //note: "display dmg" is ilvl multi*item dmg*dmg% (before "increments" are applied), where dmg% is the first or second argument in dmg_elec(100,100)

            //TODO: weapon ranges
            //TODO: add affix names to properties
            //TODO: sword attack rates
            //TODO: wtf is up with ilvls that don't match any of the listed numbers (maxlevel, fixedlevel, level)?

            //long term TODO: assign unit types so "isa" functions (among other things) work

            args = new[] { "ITEMS" };

            //new Items(manager).WriteAllUniqueLegendaryItemPages();
            //return;

            string     sqlStatement;
            WikiScript script;

            foreach (string arg in args)
            {
                switch (arg)
                {
                case "ACHIEVEMENTS":
                    script = new Achievements(manager);
                    break;

                case "AFFIXES":
                    script = new Affixes(manager);
                    break;

                case "BASEWAVES":
                    script = new BaseDefenseWaves(manager);
                    break;

                case "MONSTERAFFIXES":
                    script = new MonsterAffixes(manager);
                    break;

                case "ARMORAFFIXES":
                    script = new ArmorAffixes(manager);
                    break;

                case "ITEMLEVELS":
                    script = new ItemLevels(manager);
                    break;

                case "LEVELS":
                    script = new Levels(manager);
                    break;

                case "MONSTERS":
                    script = new Monsters(manager);
                    break;

                case "PVPRANKS":
                    script = new PVPRanks(manager);
                    break;

                case "LEVELSCALING":
                    script = new LevelScaling(manager);
                    break;

                case "ITEMS":
                    script = new Items(manager);
                    break;

                case "ITEM_QUALITY":
                    script = new ItemQuality(manager);
                    break;

                case "TREASURE":
                    script = new NewTreasure(manager);
                    break;

                case "MONSTER_QUALITY":
                    script = new MonsterQuality(manager);
                    break;

                case "RECIPES":
                    script = new Recipes(manager);
                    break;

                case "ITEM_SETS":
                    script = new Sets(manager);
                    break;

                default:
                    throw new Exception("Unknown WikiScript: " + arg);
                }

                sqlStatement = script.ExportTableInsertScript();

                File.WriteAllText(arg.ToLower() + ".sql", sqlStatement);
            }

            return;
        }
 public void KillMonster(int key)
 {
     DestroyMonster(key);
     Monsters.Remove(key);
     ReallocateMonsterIndex();
 }