Пример #1
0
        public void CastArcaneOffense(Monster monster, Player player, int index)
        {
            monster.EnergyPoints -= monster.Spellbook[index].EnergyCost;

            string attackString = $"The {monster.Name} casts a bolt of lightning at you!";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackString);

            int arcaneSpellDamage = MonsterHelper.CalculateSpellDamage(player, monster, index);

            arcaneSpellDamage = CombatHelper.GetMonsterAttackDamageUpdatedFromPlayerEffects(player, monster, arcaneSpellDamage);

            if (arcaneSpellDamage == 0)
            {
                return;
            }

            player.HitPoints -= arcaneSpellDamage;

            string attackSuccessString = $"The {monster.Name} hits you for {arcaneSpellDamage} arcane damage.";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackSuccessString);
        }
Пример #2
0
 public ActionResult Edit(Monster monster)
 {
     if (ModelState.IsValid)
     {
         MonsterHelper.CalculateMonsterStats(monster);
         db.Entry(monster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(monster));
 }
Пример #3
0
        public ActionResult Create(Monster monster)
        {
            if (ModelState.IsValid)
            {
                MonsterHelper.CalculateMonsterStats(monster);
                db.Monsters.Add(monster);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(monster));
        }
Пример #4
0
        public int ArmorRating(Player player)
        {
            int    totalArmorRating = MonsterHelper.CheckArmorRating(this);
            int    levelDiff        = player.Level - Level;
            double armorMultiplier  = 1.00 + (-(double)levelDiff / 5);
            double adjArmorRating   = totalArmorRating * armorMultiplier;

            if (ElementalCategory != null)
            {
                adjArmorRating += 20;
            }

            return((int)adjArmorRating);
        }
Пример #5
0
        public void CastFireOffense(Monster monster, Player player, int index)
        {
            monster.EnergyPoints -= monster.Spellbook[index].EnergyCost;

            string attackString = monster.MonsterCategory == MonsterType.Dragon
                                ? $"The {monster.Name} breathes a pillar of fire at you!"
                                : $"The {monster.Name} casts a fireball and launches it at you!";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackString);

            int fireSpellDamage = MonsterHelper.CalculateSpellDamage(player, monster, index);

            fireSpellDamage = CombatHelper.GetMonsterAttackDamageUpdatedFromPlayerEffects(player, monster, fireSpellDamage);

            if (fireSpellDamage == 0)
            {
                return;
            }

            player.HitPoints -= fireSpellDamage;

            string attackSuccessString = $"The {monster.Name} hits you for {fireSpellDamage} fire damage.";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackSuccessString);

            if (monster.Spellbook[index].Offensive.AmountOverTime > 0)
            {
                const string onFireString = "You burst into flame!";
                OutputHelper.Display.StoreUserOutput(
                    Settings.FormatOnFireText(),
                    Settings.FormatDefaultBackground(),
                    onFireString);

                EffectOverTimeSettings effectOverTimeSettings = new EffectOverTimeSettings {
                    AmountOverTime = monster.Spellbook[index].Offensive.AmountOverTime,
                    EffectHolder   = player,
                    MaxRound       = monster.Spellbook[index].Offensive.AmountMaxRounds,
                    Name           = monster.Spellbook[index].Name
                };
                player.Effects.Add(new BurningEffect(effectOverTimeSettings));
            }
        }
Пример #6
0
    private void Start()
    {
        hitHelper        = GameObject.FindObjectOfType <HitHelper>();
        monsterHelper    = GameObject.FindObjectOfType <MonsterHelper>();
        playerHelper     = GameObject.FindObjectOfType <PlayerHelper>();
        gameHelper       = GameObject.FindObjectOfType <GameHelper>();
        monsterBarHelper = GameObject.FindObjectOfType <MonsterBarHelper>();

        foreach (Skill skill in skills)
        {
            skill.currentCoolDown = skill.coolDown;
        }

        PlayerPrefs.SetInt("HPBottle", byttlePlayerHp);
        PlayerPrefs.SetInt("EnergyBottle", byttlePlayerEnergy);
    }
Пример #7
0
        public void APIStartMonsterBattle(int battleCell, string pattern)
        {
            MonsterGroup group = new MonsterGroup()
            {
                CellID = battleCell,
            };

            foreach (var monster in pattern.Split('|'))
            {
                if (monster.Trim() != string.Empty)
                {
                    var data = monster.Trim().Split(',');
                    var m    = MonsterHelper.GetMonsterTemplate(int.Parse(data[0])).GetLevel(int.Parse(data[1]));
                    group.AddMonster(m);
                }
            }
            Handlers.GameHandler.StartMonstersBattle(this, group);
        }
Пример #8
0
        public void CastFrostOffense(Monster monster, Player player, int index)
        {
            monster.EnergyPoints -= monster.Spellbook[index].EnergyCost;

            string attackString = $"The {monster.Name} conjures up a frostbolt and launches it at you!";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackString);

            int frostSpellDamage = MonsterHelper.CalculateSpellDamage(player, monster, index);

            frostSpellDamage = CombatHelper.GetMonsterAttackDamageUpdatedFromPlayerEffects(player, monster, frostSpellDamage);

            if (frostSpellDamage == 0)
            {
                return;
            }

            player.HitPoints -= frostSpellDamage;

            string attackSuccessString = $"The {monster.Name} hits you for {frostSpellDamage} frost damage.";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackSuccessString);

            EffectSettings frozenEffectSettings = new EffectSettings {
                EffectHolder = player,
                MaxRound     = monster.Spellbook[index].Offensive.AmountMaxRounds,
                Name         = monster.Spellbook[index].Name
            };

            player.Effects.Add(new FrozenEffect(frozenEffectSettings));

            const string frozenString = "You are frozen. Physical, frost and arcane damage to you will be increased by 50%!";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                frozenString);
        }
Пример #9
0
    public void OnStart()
    {
        smc            = new StateMachineController();
        lightsmc       = new StateMachineController();
        player         = Common.GetStealthPlayer();
        binds          = GameObject.GetGameObjectByName("Monster4Binds");
        attackParticle = GameObject.GetGameObjectByName("Monster4AttackParts").GetComponent <CParticleEmitter>();
        attackParticle.setEnabled(false);
        poofParticle = GameObject.GetGameObjectByName("Monster4Poof").GetComponent <CParticleEmitter>();
        mlight       = gameObject.GetComponentInChildren <CLight>();
        sound        = gameObject.RequireComponent <CSound>();

        screen = Common.GetConsoleScreenScript();

        mesh = GameObject.GetGameObjectByName("M4Mesh").RequireComponent <CMeshRenderer>();

        hunting         = new State(smc, S_hunting_Start, S_hunting_Update, null);
        respawning      = new State(smc, S_respawning_Start, null, S_respawning_End, RESPAWNTIME, hunting);
        attacking       = new State(smc, S_attacking_Start, S_attacking_Update, S_attacking_End);
        attacking_intro = new State(smc, S_attacking_intro_Start, S_attacking_intro_Update, null, 1.0f, attacking);
        incoming        = new State(smc, S_incoming_Start, S_incoming_Update, null, 3.0f, respawning);
        hurting         = new State(smc, S_hurting_Start, S_hurting_Update, null, 1.0f, respawning);
        idle            = new State(smc);
        dying           = new State(smc, S_dying_Start, null, S_dying_End, 2.0f, idle);

        //light smc
        hold       = new State(lightsmc, null, null, null);
        turningoff = new State(lightsmc, null, S_turningoff_Update, null, 0.5f, hold);
        turningon  = new State(lightsmc, null, S_turningon_Update, null, 0.5f, hold);

        //binds smc
        bindssmc      = new StateMachineController();
        bindhold      = new State(bindssmc, null, null, null);
        bindsmoveup   = new State(bindssmc, S_bindsmoveup_Start, S_bindsmoveup_Update, null, 0.5f, bindhold);
        bindsmovedown = new State(bindssmc, null, S_bindsmovedown_Update, S_bindsmovedown_End, 0.5f, bindhold);

        helper = new MonsterHelper();

        smc.SetState(respawning);
        lightsmc.SetState(hold);

        DisplayCorruption();
    }
Пример #10
0
    public void OnStart()
    {
        STALK_RANGE = DEFAULT_STALK_RANGE;

        //dependencies
        //cmesh = gameObject.RequireComponent<CMeshRenderer>();
        stealth_player = Common.GetStealthPlayer();
        monster3Woman = GetScript<Monster3Woman>(GameObject.GetGameObjectByName("Monster3Woman"));
        sound = gameObject.RequireComponent<CSound>();

        //states
        smc = new StateMachineController();
        inactive = new State(smc, null, null, null);
        incoming = new State(smc, State_Incoming_Start, State_Incoming_Update, null);
        stalking = new State(smc, State_Stalking_Start, State_Stalking_Update, null, 5.0f, incoming);
        resetting = new State(smc, State_Reset_Start, State_Reset_Update, null, 18.0f, stalking);
        attacking = new State(smc, State_Attacking_Start, State_Attacking_Update, State_Attacking_End, 4.0f, inactive);
        panicking = new State(smc, State_Panicking_Start, State_Panicking_Update, State_Panicking_End, 1.5f, resetting);

        helper = new MonsterHelper();

        smc.SetState(resetting);
    }
Пример #11
0
    public void OnStart()
    {
        STALK_RANGE = DEFAULT_STALK_RANGE;

        //dependencies
        //cmesh = gameObject.RequireComponent<CMeshRenderer>();
        stealth_player = Common.GetStealthPlayer();
        monster3Woman  = GetScript <Monster3Woman>(GameObject.GetGameObjectByName("Monster3Woman"));
        sound          = gameObject.RequireComponent <CSound>();

        //states
        smc       = new StateMachineController();
        inactive  = new State(smc, null, null, null);
        incoming  = new State(smc, State_Incoming_Start, State_Incoming_Update, null);
        stalking  = new State(smc, State_Stalking_Start, State_Stalking_Update, null, 5.0f, incoming);
        resetting = new State(smc, State_Reset_Start, State_Reset_Update, null, 18.0f, stalking);
        attacking = new State(smc, State_Attacking_Start, State_Attacking_Update, State_Attacking_End, 4.0f, inactive);
        panicking = new State(smc, State_Panicking_Start, State_Panicking_Update, State_Panicking_End, 1.5f, resetting);

        helper = new MonsterHelper();

        smc.SetState(resetting);
    }
Пример #12
0
        private void DrawMonsterInfo(IActorViewModel actorViewModel, SpriteBatch spriteBatch, int viewPortWidth,
                                     int viewPortHeight)
        {
            if (actorViewModel.Actor.Person is not MonsterPerson monsterPerson)
            {
                return;
            }

            var position = new Vector2(viewPortWidth - 100, viewPortHeight - 100);

            spriteBatch.DrawString(_uiContentStorage.GetAuxTextFont(), MonsterHelper.GetPerkHintText(monsterPerson),
                                   position, Color.White);
            var isNumbersShow = false;

#if SHOW_NUMS
            isNumbersShow = true;
#endif

            if (isNumbersShow)
            {
                var stats = monsterPerson.GetModule <ISurvivalModule>().Stats;
                var monsterCombatActModule = monsterPerson.GetModule <ICombatActModule>();
                var defaultAct             = monsterCombatActModule.GetCurrentCombatActs().First();
                spriteBatch.DrawString(_uiContentStorage.GetAuxTextFont(), GetRollAsString(defaultAct.Efficient),
                                       position + new Vector2(0, 16), Color.White);
                for (var statIndex = 0; statIndex < stats.Length; statIndex++)
                {
                    var stat         = stats[statIndex];
                    var offsetY      = statIndex * 16;
                    var statPosition = new Vector2(0, 32 + offsetY);
                    var statText     = $"{stat.Type} - {stat.Value} ({stat.ValueShare:0.##})";
                    spriteBatch.DrawString(_uiContentStorage.GetAuxTextFont(), statText, position + statPosition,
                                           Color.White);
                }
            }
        }
Пример #13
0
    public void OnStart()
    {
        smc = new StateMachineController();
        lightsmc = new StateMachineController();
        player = Common.GetStealthPlayer();
        binds = GameObject.GetGameObjectByName("Monster4Binds");
        attackParticle = GameObject.GetGameObjectByName("Monster4AttackParts").GetComponent<CParticleEmitter>();
        attackParticle.setEnabled(false);
        poofParticle = GameObject.GetGameObjectByName("Monster4Poof").GetComponent<CParticleEmitter>();
        mlight = gameObject.GetComponentInChildren<CLight>();
        sound = gameObject.RequireComponent<CSound>();

        screen = Common.GetConsoleScreenScript();

        mesh = GameObject.GetGameObjectByName("M4Mesh").RequireComponent<CMeshRenderer>();

        hunting = new State(smc, S_hunting_Start, S_hunting_Update, null);
        respawning = new State(smc, S_respawning_Start, null, S_respawning_End, RESPAWNTIME, hunting);
        attacking = new State(smc, S_attacking_Start, S_attacking_Update, S_attacking_End);
        attacking_intro = new State(smc, S_attacking_intro_Start, S_attacking_intro_Update, null, 1.0f, attacking);
        incoming = new State(smc, S_incoming_Start, S_incoming_Update, null, 3.0f, respawning);
        hurting = new State(smc, S_hurting_Start, S_hurting_Update, null, 1.0f, respawning);
        idle = new State(smc);
        dying = new State(smc, S_dying_Start, null, S_dying_End, 2.0f, idle);

        //light smc
        hold = new State(lightsmc, null, null, null);
        turningoff = new State(lightsmc, null, S_turningoff_Update, null, 0.5f, hold);
        turningon = new State(lightsmc, null, S_turningon_Update, null, 0.5f, hold);

        //binds smc
        bindssmc = new StateMachineController();
        bindhold = new State(bindssmc, null, null, null);
        bindsmoveup = new State(bindssmc, S_bindsmoveup_Start, S_bindsmoveup_Update, null, 0.5f, bindhold);
        bindsmovedown = new State(bindssmc, null, S_bindsmovedown_Update, S_bindsmovedown_End, 0.5f, bindhold);

        helper = new MonsterHelper();

        smc.SetState(respawning);
        lightsmc.SetState(hold);

        DisplayCorruption();
    }