コード例 #1
0
ファイル: SkillModule.cs プロジェクト: telmengedar/StreamRC
        public bool CanCastHeal(long playerid)
        {
            SkillConsumption skill = GetSkill(playerid, SkillType.Heal);

            if (skill == null)
            {
                return(false);
            }

            return(GetSkillCost(SkillType.Heal, skill.Level) <= context.GetModule <PlayerModule>().GetPlayer(playerid).CurrentMP);
        }
コード例 #2
0
ファイル: SkillModule.cs プロジェクト: telmengedar/StreamRC
        void CastHeal(string channel, User user, Player player)
        {
            SkillConsumption skill = GetSkill(player.UserID, SkillType.Heal);

            if (skill == null)
            {
                context.GetModule <StreamModule>().SendMessage(user.Service, channel, user.Name, $"You don't know anything about {SkillType.Heal}.");
                return;
            }

            int cost = GetSkillCost(SkillType.Heal, skill.Level);

            if (cost > player.CurrentMP)
            {
                context.GetModule <StreamModule>().SendMessage(user.Service, channel, user.Name, "Not enough mana.");
                return;
            }

            int healed = 0;

            switch (skill.Level)
            {
            case 1:
                healed = 5 + (int)(player.Intelligence * 0.5);
                break;

            case 2:
                healed = 12 + (int)(player.Intelligence * 0.83);
                break;

            case 3:
                healed = 30 + (int)(player.Intelligence * 1.22);
                break;
            }

            healed = Math.Min(player.MaximumHP - player.CurrentHP, healed);
            context.Database.Update <Player>().Set(p => p.CurrentHP == p.CurrentHP + healed, p => p.CurrentMP == p.CurrentMP - cost).Where(p => p.UserID == player.UserID).Execute();
            context.GetModule <RPGMessageModule>().Create().User(user).Text(" casts ").Skill(SkillType.Heal).Text(" and heals ").Health(healed).Text(".").Send();
        }