Exemple #1
0
 protected void OpenRugularDoor(Creature.Player pl)
 {
     pl.Map[doorPos.Item1, doorPos.Item2].IsDoorOpened = true;
     pl.PosX = doorPos.Item2;
     pl.PosY = doorPos.Item1;
     pl.PosChanged();
 }
Exemple #2
0
        protected void BalanceMonster(Creature.Player player)
        {
            this.expFromEnemy      = (int)Math.Round(Game.Settings.Enemy_Lvl_expMod[monsterDifficult] * Game.Settings.Enemy_Lvl_BasicExp);
            this.hitPoints.Max     = (int)Math.Round(player.hitPoints.Max / Game.Settings.Enemy_Lvl_HpDiv[monsterDifficult]);
            this.hitPoints.Current = this.hitPoints.Max;

            ushort monsterLevel = player.level.CurrentLvl;

            if (player.level.CurrentLvl < minMonsterLevel || player.level.CurrentLvl > maxMonsterLevel)
            {
                monsterLevel = maxMonsterLevel;
            }

            expFromEnemy += Game.Settings.Enemy_Lvl_BonusExpPerLvl * (monsterLevel - 1);
            if (monsterLevel != player.level.CurrentLvl)
            {
                short diff = (short)((monsterLevel - player.level.CurrentLvl) / 3);
                if (diff > 0)
                {
                    while (diff-- != 0)
                    {
                        expFromEnemy = (int)Math.Round(expFromEnemy * Game.Settings.ExpBonusPerLevelAbove);
                    }
                }
                else if (diff < 0)
                {
                    while (diff++ != 0)
                    {
                        expFromEnemy = (int)Math.Round(expFromEnemy * Game.Settings.ExpPenaltyPerLevelBelow);
                    }
                }
                if (expFromEnemy < 0)
                {
                    expFromEnemy = 0;
                }
            }

            ushort maxStat = (ushort)(Game.Settings.player_init_armor + Game.Settings.player_init_attack - 1 +
                                      monsterLevel - 1 +
                                      Math.Round((player.UsedArmor?.armorMod ?? 0) * Game.Settings.Enemy_Mult_ArmorStat +
                                                 (player.UsedWeapon?.dmgMod ?? 0) * Game.Settings.Enemy_Mult_WeaponStat)
                                      );

            this.attack.Current = 1;
            this.armor.Current  = 0;
            while (maxStat-- != 0)
            {
                if (Game.Rand.NextPersent() < this.statChanceAttack)
                {
                    ++this.attack.Current;
                }
                else
                {
                    ++this.armor.Current;
                }
            }
        }
Exemple #3
0
        protected void OpenNextLvlDoor(Creature.Player pl)
        {
            pl.PosX = doorPos.Item2;
            pl.PosY = doorPos.Item1;

            Support.DialogBox.ChangeToDialog("You complete the level. Whats next?",
                                             "Continue explore",
                                             pl.Map.globalMap.CanMoveLeft ? "Left" + pl.Map.globalMap.LeftFromPlayer.CellName : null,
                                             pl.Map.globalMap.CanMoveUp ? "Up" + pl.Map.globalMap.UpFromPlayer.CellName : null,
                                             pl.Map.globalMap.CanMoveRight ? "Right" + pl.Map.globalMap.RightFromPlayer.CellName : null,
                                             pl.Map.globalMap.CanMoveDown ? "Down" + pl.Map.globalMap.DownFromPlayer.CellName : null
                                             );

            System.Timers.Timer t = new System.Timers.Timer()
            {
                AutoReset = true,
                Enabled   = false,
                Interval  = 100,
            };

            t.Elapsed += (a, b) => {
                System.Windows.Application.Current.Dispatcher.Invoke((Action) delegate {
                    if (Support.DialogBox.isChoose)
                    {
                        byte choose = Support.DialogBox.choose;
                        if (choose == 1)
                        {
                            pl.Map.globalMap.MoveLeft();
                        }
                        else if (choose == 2)
                        {
                            pl.Map.globalMap.MoveUp();
                        }
                        else if (choose == 3)
                        {
                            pl.Map.globalMap.MoveRight();
                        }
                        else if (choose == 4)
                        {
                            pl.Map.globalMap.MoveDown();
                        }

                        RecreateLvl(pl);
                        t.Stop();
                    }
                });
            };

            t.Start();
        }
Exemple #4
0
 protected Tuple <byte, byte> FindDoor(Creature.Player pl)
 {
     for (byte i = 0; i < pl.Map.SizeY; ++i)
     {
         for (byte j = 0; j < pl.Map.SizeX; ++j)
         {
             if (pl.Map[i, j].IsDoor && pl.Map[i, j].DoorId == DoorId && !pl.Map[i, j].IsInFog)
             {
                 return(new Tuple <byte, byte>(i, j));
             }
         }
     }
     return(null);
 }
Exemple #5
0
        public Ghost1(Creature.Player player)
        {
            this.monsterDifficult = 0;
            monsterImgPath       += @"Ghost1";
            monsterName           = "Ghost junior";

            //this.manaPoints.Max = 9;
            //this.manaPoints.Current = 9;

            //this.hitPoints.Max = 9;
            //this.hitPoints.Current = 9;

            //this.armor.Base = 2;
            //this.armor.Current = 2;

            //this.attack.Base = 2;
            //this.attack.Current = 2;
            this.BalanceMonster(player);
        }
Exemple #6
0
        public Ghost2(Creature.Player player)
        {
            monsterDifficult = 1;
            monsterImgPath  += @"Ghost2";
            monsterName      = "Ghost middle";

            //this.manaPoints.Max = 15;
            //this.manaPoints.Current = 15;

            //this.hitPoints.Max = 15;
            //this.hitPoints.Current = 15;

            //this.armor.Base = 4;
            //this.armor.Current = 4;

            //this.attack.Base = 4;
            //this.attack.Current = 4;
            this.BalanceMonster(player);
        }
Exemple #7
0
        public Ghost3(Creature.Player player)
        {
            statChanceAttack = 75;
            monsterDifficult = 2;
            monsterImgPath  += @"Ghost3";
            monsterName      = "Ghost senior";

            //this.manaPoints.Max = 28;
            //this.manaPoints.Current = 28;

            //this.hitPoints.Max = 28;
            //this.hitPoints.Current = 28;

            //this.armor.Base = 6;
            //this.armor.Current = 6;

            //this.attack.Base = 6;
            //this.attack.Current = 6;
            this.BalanceMonster(player);
        }
Exemple #8
0
        public void RecreateLevel(GameMap map, Creature.Player player)
        {
REPEAT_CREATION:
            try {
                byte randPersent = Game.Rand.NextPersent();
                for (byte i = 0, currMinNum = 0; i < globalMap[playerPosY, playerPosX].ChanceGenerator.Count; ++i)
                {
                    currMinNum += globalMap[playerPosY, playerPosX].ChanceGenerator[i];
                    if (randPersent < currMinNum)
                    {
                        globalMap[playerPosY, playerPosX].Generators[i].GenerateMap(map, player);
                        break;
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message + '\n' + ex.StackTrace + "\n\n\n\n Write to developer about it, pls)\nPress OK for new attempt", "Error in creation!", MessageBoxButton.OK, MessageBoxImage.Error);
                goto REPEAT_CREATION;
            }
        }
Exemple #9
0
        public override bool CardUsed(Creature.Player pl)
        {
            if (pl.IsInBattle)
            {
                return(false);
            }

            doorPos = FindDoor(pl);

            if (doorPos != null)
            {
                if (pl.Map[doorPos.Item1, doorPos.Item2].DoorId == 0)
                {
                    OpenNextLvlDoor(pl);
                }
                else
                {
                    OpenRugularDoor(pl);
                }
                return(true);
            }

            return(false);
        }
Exemple #10
0
 public override void GenerateMap(GameMap map, Creature.Player player)
 {
     base.GenerateMap(map, player);
 }
Exemple #11
0
 public void NewLevel(Creature.Player player)
 {
     ClearMap();
     RandomFill(player);
     player.ChangeToMaze();
 }
Exemple #12
0
 protected void RecreateLvl(Creature.Player pl)
 {
     pl.Map.NewLevel(pl);
     pl.ChangeToMaze();
     pl.Map.globalMap.SetMarkerPos();
 }
Exemple #13
0
 public override bool PlayerStepIn(Creature.Player player)
 {
     PrintText("HP trap!");
     player.hitPoints.Current -= player.hitPoints.Current / 4;
     return(true);
 }
Exemple #14
0
 abstract public void GenerateMap(GameMap map, Creature.Player player);
Exemple #15
0
 public override bool CardUsed(Creature.Player player)
 {
     player.EquipArmor(this);
     return(true);
 }
Exemple #16
0
 public override bool CardUsed(Creature.Player player)
 {
     player.manaPoints.Current += (int)Math.Round(player.manaPoints.Max * 0.20);
     return(true);
 }
Exemple #17
0
 void RandomFill(Creature.Player player)
 {
     globalMap.RecreateLevel(this, player);
 }