Пример #1
0
 private async Task UpdateMonsterAttackBlocks(SpawnedMonster spawnedMonster, string url)
 {
     if (spawnedMonster.IsDead())
     {
         await _slack.DeleteInteractionMessage(url);
     }
     else
     {
         await _slack.UpdateInteractionMessage(new MonsterMenu(spawnedMonster).Blocks, url);
     }
 }
Пример #2
0
        private async Task DealDamageToMonster(User user, Attack attack, SpawnedMonster spawnedMonster, string channel)
        {
            var monster = spawnedMonster.Monster;
            var message = attack.Status.ToMessage(_userService.Mention(user), $"*{monster.Name}*", attack.Damage);
            await _slack.BroadcastMessage(message, channel);

            _spawnedMonsterRepository.RegisterUserDamage(spawnedMonster.Id, user.Id, attack.Damage, spawnedMonster.Health);

            if (spawnedMonster.IsDead())
            {
                await _monsterService.HandleMonsterDeathByUser(user, spawnedMonster, channel);
            }
            else if (!spawnedMonster.IsAttackOnCooldown())
            {
                await MonsterAttackUser(spawnedMonster, user, channel);
            }
        }