Пример #1
0
        public void Interact(Position pos)
        {
            Game.PlayerRef.AddLifes(this.value);
            string properLifeString = this.value == 1 ? "life" : "lifes";

            GameMessage.SendMessage("INFO : You picked up " + this.value + " bonus " + properLifeString);
        }
Пример #2
0
 public void Interact(Position pos)
 {
     if (this.OwnQuest.IsCompleted())
     {
         GameMessage.SendMessage($"Thank You for help! I will never forget it!");
     }
     else
     {
         GameMessage.SendMessage($"NEW QUEST!\n{this.OwnQuest.Type}\n[O] Accept\n[P] Decline");
     }
 }
Пример #3
0
        public void Interact(Position pos)
        {
            if (IsOpened)
            {
                Touch();
                return;
            }
            Game.PlayerRef.Score += this.Treasure; // todo fix player event
            this.IsOpened         = true;
            if (this.IsTreasure)
            {
                GameMessage.SendMessage("MISSION INFO: You found the hidden treasure!");
                return;
            }
            string properPointsString = this.Treasure == 1 ? "point" : "points";

            GameMessage.SendMessage("INFO : You picked up " + this.Treasure + " bonus " + properPointsString);
        }
Пример #4
0
        private void MonsterAttackOnPlayerProximity(int y, int x)
        {
            Position[] positionsToCheck = new Position[]
            {
                new Position(-1, -1),       // strong
                new Position(1, 1),         // strong
                new Position(1, -1),        // strong
                new Position(-1, 1),        // strong
                new Position(-1, 0),
                new Position(0, -1),
                new Position(0, 1),
                new Position(1, 0),
            };

            AbstractMonster monster = null;

            foreach (Position p in positionsToCheck)
            {
                try
                {
                    monster = AbstractMonster.Monsters.Find(m => m.Position + p == Game.PlayerRef.Position);
                    if (monster != null)
                    {
                        break;
                    }
                }
                catch (ArgumentNullException e)
                {
                    ErrorDisplayService.ShowError(e);
                    return;
                }
            }

            if (monster == null)
            {
                return;
            }

            if (monster is MonsterMediumTile || monster is MonsterWeakTile)
            {
                if (monster.Position + positionsToCheck[0] == Game.PlayerRef.Position ||
                    monster.Position + positionsToCheck[1] == Game.PlayerRef.Position ||
                    monster.Position + positionsToCheck[2] == Game.PlayerRef.Position ||
                    monster.Position + positionsToCheck[3] == Game.PlayerRef.Position)
                {
                    return;
                }
            }

            int monsterDamage = monster.Power;

            // weak = 25% chance     -||    range is {0,1,2,3}  ]
            // medium = 33% chance   -||    range is {0,1,2}    ]---- condition is only true for 0
            // strong = 50% chance   -\/    range is {0,1}      ]
            int    damage      = new Random().Next(0, Constants.MosterDamageChanceProbablitor - monsterDamage);
            string monsterType = monster is MonsterWeakTile ? "Weak" : monster is MonsterMediumTile ? "Medium" : "Strong";

            if (damage % Constants.MosterDamageChanceProbablitor == 0)
            {
                GameMessage.SendMessage($"ATTACKED! : {monsterType} monster hit you and\ncaused {monsterDamage} damage to You!");
                Game.PlayerRef.ApplyDamage(monsterDamage);
            }
        }
Пример #5
0
 public void Touch()
 {
     GameMessage.SendMessage($"INFO: You touched {itemName}");
 }