/// <summary>
        /// Increment time - if we have exceeded the duration, call OnExit() and then mark as finished
        /// </summary>
        public override void IncrementTime(Player target)
        {
            currentTicks++;

            if (currentTicks > GetDuration())
            {
                OnEnd(target);
                hasEnded = true;
            }
        }
Пример #2
0
        public Dungeon()
        {
            levels = new List<Map>();
            monsters = new List<Monster>();
            items = new List<Item>();
            features = new List<Feature>();
            levelTCODMaps = new List<TCODFov>();
            effects = new List<DungeonEffect>();

            player = new Player();
        }
Пример #3
0
        // <summary>
        /// Train REST 1 day at weekend level
        /// </summary>
        /// <param name="player"></param>
        public void WeekendTrainRest(Player player)
        {
            //Set player
            this.player = player;

            TrainHitpointStat(75, 4);
            TrainMaxHitpointStat(0, 0);
            TrainSpeedStat(5, -1);
            TrainAttackStat(5, -1);
            TrainCharmStat(5, 1);
            TrainMagicStat(5, -1);
        }
 public PlayerEffectSimpleDuration(Player player)
     : base(player)
 {
 }
Пример #5
0
        public override CombatResults AttackPlayer(Player player)
        {
            LogFile.Log.LogEntryDebug(this.Representation + " attacks player.", LogDebugLevel.Medium);

            return CombatResults.NeitherDied;
        }
Пример #6
0
        /// <summary>
        /// Train MAGIC 1 day at weekday level
        /// </summary>
        /// <param name="player"></param>
        public void WeekendTrainMagic(Player player)
        {
            this.player = player;

            if (player.HitpointsStat == minimumHitpointStat)
            {
                Game.MessageQueue.AddMessage("You are so tired you can't get anything done. Time for rest?");
                return;
            }

            TrainHitpointStat(20, -1);
            TrainMaxHitpointStat(5, -1);
            TrainSpeedStat(0, 0);
            TrainAttackStat(5, -1);
            TrainCharmStat(5, -1);
            TrainMagicStat(50, 1);
        }
Пример #7
0
        private void DrawPC(int levelToDraw, Player player)
        {
            if (player.LocationLevel != levelToDraw)
                return;

            Point PClocation = player.LocationMap;
            Color PCDrawColor = PCColor;

            if (DebugMode)
            {
                MapSquare pcSquare = Game.Dungeon.Levels[player.LocationLevel].mapSquares[player.LocationMap.x, player.LocationMap.y];

                if (pcSquare.InMonsterFOV)
                {
                    PCDrawColor = Color.Interpolate(PCDrawColor, ColorPresets.Red, 0.4);
                }
            }

            if (!isViewVisible(PClocation))
                return;

            char pcRepresentation = player.Representation;

            var colorToUse = PCDrawColor;

            var hasActiveWetware = player.GetEquippedWetware();

            if (hasActiveWetware != null)
            {
                colorToUse = ColorPresets.LightSkyBlue;

                if (hasActiveWetware.GetType() == typeof(Items.StealthWare))
                    pcRepresentation = (char)256;
            }

            tileMapLayer(TileLevel.Creatures)[ViewRelative(PClocation)] = new TileEngine.TileCell(pcRepresentation);
            tileMapLayer(TileLevel.Creatures)[ViewRelative(PClocation)].TileFlag = new LibtcodColorFlags(colorToUse);
        }
Пример #8
0
 /// <summary>
 /// Process a player interacting with this object
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public abstract bool PlayerInteraction(Player player);
Пример #9
0
 /// <summary>
 /// Carries out the end effects on the target. Many standard effects just use the stat modifier virtual functions.
 /// </summary>
 public abstract void OnEnd(Player target);
Пример #10
0
 public abstract CombatResults AttackPlayer(Player player);
Пример #11
0
 private static void RemoveEffectsDueToThrowing(Player player)
 {
     //player.RemoveEffect(typeof(PlayerEffects.StealthBoost));
 }
Пример #12
0
 /// <summary>
 /// Called every click. If the event duration is over, call OnEnd() and mark as ended
 /// </summary>
 public abstract void IncrementTime(Player target);
Пример #13
0
 private static void RemoveEffectsDueToFiringWeapon(Player player)
 {
     //player.RemoveEffect(typeof(PlayerEffects.StealthBoost));
     //player.RemoveEffect(typeof(PlayerEffects.SpeedBoost));
     player.CancelBoostDueToAttack();
     player.CancelStealthDueToAttack();
 }
Пример #14
0
        private void DrawStats(Player player)
        {
            //Blank stats area
            //rootConsole.DrawRect(statsDisplayTopLeft.x, statsDisplayTopLeft.y, Width - statsDisplayTopLeft.x, Height - statsDisplayTopLeft.y, true);
            DrawFrame(statsDisplayTopLeft.x, statsDisplayTopLeft.y - 1, statsDisplayBotRight.x - statsDisplayTopLeft.x + 2, statsDisplayBotRight.y - statsDisplayTopLeft.y + 3, false, statsFrameColor);

            int baseOffset = 2;

            //Mission
            Point missionOffset = new Point(baseOffset, 0);
            hitpointsOffset = new Point(baseOffset, 4);
            Point shieldOffset = new Point(baseOffset, 5);
            Point weaponOffset = new Point(baseOffset, 8);
            Point utilityOffset = new Point(baseOffset, 14);
            Point viewOffset = new Point(baseOffset, 20);
            Point cmbtOffset = new Point(baseOffset, 18);
            Point gameDataOffset = new Point(baseOffset, 25);

            var zoneName = "[" + (LevelToDisplay).ToString("00") + "] ";
            var zoneName2 = Game.Dungeon.DungeonInfo.LookupMissionName(LevelToDisplay);
            PrintLine(zoneName, statsDisplayTopLeft.x + missionOffset.x, statsDisplayTopLeft.y + missionOffset.y + 1, LineAlignment.Left, statsColor);
            PrintLine(zoneName2, statsDisplayTopLeft.x + missionOffset.x, statsDisplayTopLeft.y + missionOffset.y + 2, LineAlignment.Left, statsColor);

            //Draw HP Status

            int hpBarLength = 10;
            double playerHPRatio = player.Hitpoints / (double)player.MaxHitpoints;
            int hpBarEntries = (int)Math.Ceiling(hpBarLength * playerHPRatio);

            PrintLine("HP: ", statsDisplayTopLeft.x + hitpointsOffset.x, statsDisplayTopLeft.y + hitpointsOffset.y, LineAlignment.Left, statsColor);

            for (int i = 0; i < hpBarLength; i++)
            {
                if (i < hpBarEntries)
                {
                    PutChar(statsDisplayTopLeft.x + hitpointsOffset.x + 5 + i, statsDisplayTopLeft.y + hitpointsOffset.y, heartChar, heartColor);
                }
                else
                {
                    PutChar(statsDisplayTopLeft.x + hitpointsOffset.x + 5 + i, statsDisplayTopLeft.y + hitpointsOffset.y, heartChar, disabledColor);
                }
            }

            //Draw shield

            int shieldBarLength = 20;
            double playerShieldRatio = player.Shield / (double)player.MaxShield;
            int shieldBarEntries = (int)Math.Ceiling(shieldBarLength * playerShieldRatio);

            PrintLine("SD: ", statsDisplayTopLeft.x + shieldOffset.x, statsDisplayTopLeft.y + shieldOffset.y, LineAlignment.Left, statsColor);

            DrawShieldBar(player, shieldOffset, shieldBarEntries - 10);
            DrawShieldBar(player, shieldOffset + new Point(0, 1), Math.Min(shieldBarEntries, 10));

            //Draw equipped weapon

            Item weapon = Game.Dungeon.Player.GetEquippedWeaponAsItem();

            //string weaponStr = "Weapon: ";

            //PrintLine(weaponStr, statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y, LineAlignment.Left);

            if (weapon != null)
            {
                IEquippableItem weaponE = weapon as IEquippableItem;

                PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y, weapon.Representation, weaponColor);

                string weaponStr = weapon.SingleItemDescription;
                PrintLine(weaponStr, statsDisplayTopLeft.x + weaponOffset.x + 2, statsDisplayTopLeft.y + weaponOffset.y, LineAlignment.Left, weaponColor);

                //Ammo
                if (weaponE.HasFireAction())
                {
                    PrintLine("Am: ", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + 4, LineAlignment.Left);

                    //TODO infinite ammo?
                    int ammoBarLength = 10;
                    double weaponAmmoRatio = weaponE.RemainingAmmo() / (double) weaponE.MaxAmmo();
                    int ammoBarEntries = (int)Math.Ceiling(ammoBarLength * weaponAmmoRatio);

                    for (int i = 0; i < ammoBarLength; i++)
                    {
                        if (i < ammoBarEntries)
                        {
                            PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, ammoChar, orangeActivatedColor);
                        }
                        else
                        {
                            PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, ammoChar, orangeDisactivatedColor);
                        }
                    }
                }
                else if (weaponE.HasThrowAction() || weaponE.HasOperateAction())
                {
                    PrintLine("Am: ", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + 4, LineAlignment.Left, statsColor);

                    //TODO infinite ammo?
                    int ammoBarLength = 10;
                    int ammoBarEntries = Math.Min(player.InventoryQuantityAvailable(weapon.GetType()), 10);
                    //int ammoBarEntries = (int)Math.Ceiling(ammoBarLength * weaponAmmoRatio);

                    for (int i = 0; i < ammoBarLength; i++)
                    {
                        if (i < ammoBarEntries)
                        {
                            PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, weapon.Representation, orangeActivatedColor);
                        }
                        else
                        {
                            PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, weapon.Representation, orangeDisactivatedColor);
                        }
                    }
                }

                /*
                //Uses
                int useYOffset = 3;

                string uses = "";
                if (weaponE.HasMeleeAction())
                {
                    PrintLine("Melee", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left);
                }
                else if (weaponE.HasFireAction() && weaponE.HasThrowAction())
                {
                    PrintLine("fire   throw", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left);
                    PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("F"), ColorPresets.White);
                    PutChar(statsDisplayTopLeft.x + weaponOffset.x + 7, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("T"), ColorPresets.White);
                }

                else if (weaponE.HasFireAction())
                {
                    PrintLine("fire", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left);
                    PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("F"), ColorPresets.White);
                }

                else if (weaponE.HasThrowAction())
                {
                    PrintLine("fire", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left);
                    PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("T"), ColorPresets.White);
                }*/

                //if (weaponE.HasOperateAction())
                //{
                //    uses += "(u)se";
                //}

               // PrintLine(uses, statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + 4, LineAlignment.Left);
            }
            else
            {
                var weaponStr = "None";
                PrintLine(weaponStr, statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y, LineAlignment.Left, weaponColor);
            }

            //Draw weapon choices
            var weaponOptionRow = 1;
            var weaponIconXOffset = -3;
            foreach (var kv in ItemMapping.WeaponMapping)
            {
                DrawWeaponChar(weaponOffset + new Point(weaponIconXOffset + (kv.Key) * 3, weaponOptionRow), kv.Value, kv.Key);
            }

            //Draw energy bar and use keys

            int energyBarLength = 20;
            double playerEnergyRatio = player.Energy / (double)player.MaxEnergy;
            int energyBarEntries = (int)Math.Ceiling(energyBarLength * playerEnergyRatio);

            PrintLine("EN: ", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 2, LineAlignment.Left, statsColor);

            DrawEnergyBar(player, utilityOffset + new Point(0, 2), energyBarEntries - 10);
            DrawEnergyBar(player, utilityOffset + new Point(0, 3), Math.Min(energyBarEntries, 10));

            //Enable wetware name
            var equippedWetware = player.GetEquippedWetware();

            if (equippedWetware != null)
            {
                var equippedWetwareItem = (equippedWetware as Item);

                PutChar(statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y, equippedWetwareItem.Representation, weaponColor);

                var wetwareStr = equippedWetwareItem.SingleItemDescription;
                PrintLine(wetwareStr, statsDisplayTopLeft.x + utilityOffset.x + 2, statsDisplayTopLeft.y + utilityOffset.y, LineAlignment.Left, weaponColor);
            }
            else
            {
                PrintLine("None", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y, LineAlignment.Left, weaponColor);
            }

            //Draw all available wetware
            var wetwareOptionRow = 1;
            int offset = 0;
            foreach (var kv in ItemMapping.WetwareMapping)
            {
                DrawWetwareChar(utilityOffset + new Point(offset * 3, wetwareOptionRow), kv.Value, kv.Key.ToString());
                offset++;
            }

            //

            /*
            //Draw equipped utility

            Item utility = Game.Dungeon.Player.GetEquippedUtilityAsItem();

            string utilityStr = "Utility: ";
            PrintLine(utilityStr, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y, LineAlignment.Left);

            if (utility != null)
            {
                utilityStr = utility.SingleItemDescription;
                PrintLine(utilityStr, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 1, LineAlignment.Left, utility.GetColour());
                IEquippableItem utilityE = utility as IEquippableItem;

                string uses = "";

                if (utilityE.HasOperateAction())
                {
                    uses += "(U)se";
                }

                if (utilityE.HasThrowAction())
                {
                    uses += "(T)hrow ";
                }

                PrintLine(uses, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 2, LineAlignment.Left);
            }

            else
            {
                utilityStr = "Nothing";
                PrintLine(utilityStr, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 1, LineAlignment.Left, nothingColor);
            }

            //Effect active (add ors)
            if (player.effects.Count > 0)
            {
                PlayerEffect thisEffect = player.effects[0];

                if(thisEffect is PlayerEffectSimpleDuration) {

                    PlayerEffectSimpleDuration durationEffect = thisEffect as PlayerEffectSimpleDuration;

                    string effectName = thisEffect.GetName();
                    int effectRemainingDuration = durationEffect.GetRemainingDuration();
                    int effectTotalDuration = durationEffect.GetDuration();
                    Color effectColor = thisEffect.GetColor();

                    //Effect name

                    PrintLine("Effect: ", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 3, LineAlignment.Left);

                    PrintLine(effectName, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 4, LineAlignment.Left, effectColor);
                    //Duration

                    PrintLine("Tm: ", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 5, LineAlignment.Left);

                    int ammoBarLength = 10;
                    double weaponAmmoRatio = effectRemainingDuration / (double) effectTotalDuration;
                    int ammoBarEntries = (int)Math.Ceiling(ammoBarLength * weaponAmmoRatio);

                    for (int i = 0; i < ammoBarLength; i++)
                    {
                        if (i < ammoBarEntries)
                        {
                            PutChar(statsDisplayTopLeft.x + utilityOffset.x + 5 + i, statsDisplayTopLeft.y + utilityOffset.y + 5, explosionIcon, ColorPresets.Gold);
                        }
                        else
                        {
                            PutChar(statsDisplayTopLeft.x + utilityOffset.x + 5 + i, statsDisplayTopLeft.y + utilityOffset.y + 5, explosionIcon, ColorPresets.Gray);
                        }
                    }
                }

            }*/

            //Draw what we can see

            //Creature takes precidence

            //string viewStr = "Target: ";
            //PrintLine(viewStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y, LineAlignment.Left, statsColor);

            if (CreatureToView != null && CreatureToView.Alive == true)
            {

                               //Combat vs player

                var cover = player.GetPlayerCover(CreatureToView);
                if (cover.Item1 > 0)
                {
                    PrintLine("(hard cover)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 3, LineAlignment.Left, ColorPresets.Gold);
                }
                else if (cover.Item2 > 0)
                {
                    PrintLine("(soft cover)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 3, LineAlignment.Left, statsColor);
                }

                //PrintLine("Def: " + player.CalculateDamageModifierForAttacksOnPlayer(CreatureToView), statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 2, LineAlignment.Left, statsColor);
                //var cover = player.GetPlayerCover(CreatureToView);
                //PrintLine("C: " + cover.Item1 + "/" + cover.Item2, statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 3, LineAlignment.Left, statsColor);

                //Monster hp

                String nameStr = CreatureToView.SingleDescription;// +"(" + CreatureToView.Representation + ")";
                PrintLine(nameStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 3, LineAlignment.Left, statsColor);

                int mhpBarLength = 10;
                double mplayerHPRatio = CreatureToView.Hitpoints / (double)CreatureToView.MaxHitpoints;
                int mhpBarEntries = (int)Math.Ceiling(mhpBarLength * mplayerHPRatio);

                PrintLine("HP: ", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 4, LineAlignment.Left, statsColor);

                for (int i = 0; i < mhpBarLength; i++)
                {
                    if (i < mhpBarEntries)
                    {
                        PutChar(statsDisplayTopLeft.x + viewOffset.x + 5 + i, statsDisplayTopLeft.y + viewOffset.y + 4, heartChar, heartColor);
                    }
                    else
                    {
                        PutChar(statsDisplayTopLeft.x + viewOffset.x + 5 + i, statsDisplayTopLeft.y + viewOffset.y + 4, heartChar, disabledColor);
                    }
                }

                //Behaviour

                if (CreatureToView.StunnedTurns > 0)
                {
                    PrintLine("(Stunned: " + CreatureToView.StunnedTurns + ")", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, stunnedBackground);
                }
                else if (CreatureToView.InPursuit())
                {
                    PrintLine("(Hostile)", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, pursuitBackground);
                }
                else if (!CreatureToView.OnPatrol())
                {
                    PrintLine("(Investigating)", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, investigateBackground);
                }
                else {
                    PrintLine("(Neutral)", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, statsColor);
                }
            }
            else if (ItemToView != null && !ItemToView.InInventory)
            {
                String nameStr = ItemToView.SingleItemDescription;
                PrintLine(nameStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 3, LineAlignment.Left, ItemToView.GetColour());
            }
            else if(FeatureToView != null)
            {
                String nameStr = FeatureToView.Description;

                PrintLine(nameStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 3, LineAlignment.Left, FeatureToView.RepresentationColor());
            }

            //Combat stats
                string bonusStr = "";

                if (player.HasMeleeWeaponEquipped())
                {
                    var meleeBonus = player.CalculateMeleeAttackModifiersOnMonster(null);
                    bonusStr = meleeBonus.ToString("#.#") + "x";
                }
                else if (player.HasThrownWeaponEquipped())
                {
                    bonusStr = "";
                }
                else
                {
                    var rangedBonus = player.CalculateRangedAttackModifiersOnMonster(null);
                    bonusStr = rangedBonus.ToString("#.#") + "x";
                }

                PrintLine("Attk: " + bonusStr, statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 1, LineAlignment.Left, statsColor);

                //Defence
                var dodgeBonus = player.CalculateDamageModifierForAttacksOnPlayer(null);

                if (dodgeBonus < 0.71)
                {
                    PrintLine("(s. dodge)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 2, LineAlignment.Left, ColorPresets.Gold);
                }

                else if (dodgeBonus < 0.81)
                {
                    PrintLine("(dodge)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 2, LineAlignment.Left, statsColor);
                }

            /*
            //Game data
            PrintLine("Droids:", statsDisplayTopLeft.x + gameDataOffset.x, statsDisplayTopLeft.y + gameDataOffset.y, LineAlignment.Left);

            int noDroids = Game.Dungeon.DungeonInfo.MaxDeaths - Game.Dungeon.DungeonInfo.NoDeaths;

            for (int i = 0; i < noDroids; i++)
            {
                PutChar(statsDisplayTopLeft.x + gameDataOffset.x + 8 + i, statsDisplayTopLeft.y + gameDataOffset.y, Game.Dungeon.Player.Representation, Game.Dungeon.Player.RepresentationColor());
            }

            PrintLine("Aborts:", statsDisplayTopLeft.x + gameDataOffset.x, statsDisplayTopLeft.y + gameDataOffset.y + 1, LineAlignment.Left);

            int noAborts = Game.Dungeon.DungeonInfo.MaxAborts - Game.Dungeon.DungeonInfo.NoAborts;

            for (int i = 0; i < noAborts; i++)
            {
                PutChar(statsDisplayTopLeft.x + gameDataOffset.x + 8 + i, statsDisplayTopLeft.y + gameDataOffset.y + 1, 'X',ColorPresets.Red);
            }*/
        }
Пример #15
0
        private void DrawShieldBar(Player player, Point shieldOffset, int shieldBarFirstBar)
        {
            for (int i = 0; i < shieldBarFirstBar; i++)
            {
                if (i < shieldBarFirstBar)
                {
                    Color shieldColor = player.IsEffectActive(typeof(PlayerEffects.ShieldEnhance)) ? ColorPresets.Yellow : orangeActivatedColor;

                    PutChar(statsDisplayTopLeft.x + shieldOffset.x + 5 + i, statsDisplayTopLeft.y + shieldOffset.y, shieldChar, shieldColor);
                }
                else
                {
                    Color shieldColor = player.ShieldIsDisabled ? orangeActivatedColor : orangeDisactivatedColor;

                    PutChar(statsDisplayTopLeft.x + shieldOffset.x + 5 + i, statsDisplayTopLeft.y + shieldOffset.y, shieldChar, shieldColor);
                }
            }
        }
Пример #16
0
        /// <summary>
        /// Important to keep this the only place where the player gets injured
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public virtual CombatResults AttackPlayer(Player player)
        {
            //Recalculate combat stats if required
            if (this.RecalculateCombatStatsRequired)
                this.CalculateCombatStats();

            if (player.RecalculateCombatStatsRequired)
                player.CalculateCombatStats();

            //Calculate damage from a normal attack
            int damage = AttackCreatureWithModifiers(player, 0, 0, 0, 0);

            return AttackPlayer(player, damage);
        }
Пример #17
0
 public PlayerEffect(Player eventReceiver)
     : base(eventReceiver)
 {
     player = eventReceiver;
 }
Пример #18
0
        /// <summary>
        /// Important to keep this the only place where the player gets injured
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public virtual CombatResults AttackPlayer(Player player, int damage)
        {
            player.NotifyAttack(this);

            //Do we hit the player?
            if (damage > 0)
            {
                int monsterOrigHP = player.Hitpoints;

                var modifiedDamaged = (int)Math.Floor(player.CalculateDamageModifierForAttacksOnPlayer(this) * damage);

                player.ApplyDamageToPlayer(modifiedDamaged);

                //Is the player dead, if so kill it?
                if (player.Hitpoints <= 0)
                {

                    //Message queue string
                    string combatResultsMsg = "MvP " + this.Representation + " Dam: base: " + damage + " mod: " + modifiedDamaged + " HP: " + monsterOrigHP + "->" + player.Hitpoints + " killed";

                    //string playerMsg = "The " + this.SingleDescription + " hits you. You die.";
                    //string playerMsg = HitsPlayerCombatString() + " R. E. E. D. DESTROYED!";
                    //Game.MessageQueue.AddMessage(playerMsg);
                    LogFile.Log.LogEntryDebug(combatResultsMsg, LogDebugLevel.Medium);

                    //Game.Dungeon.SetPlayerDeath("was knocked out by a " + this.SingleDescription);

                    return CombatResults.DefenderDied;
                }

                //Debug string

                string combatResultsMsg3 = "MvP " + this.Representation + " Dam: base: " + damage + " mod: " + modifiedDamaged + " HP: " + monsterOrigHP + "->" + player.Hitpoints + " injured";
                //string playerMsg3 = "The " + this.SingleDescription + " hits you.";
                string playerMsg3 = HitsPlayerCombatString();
                Game.MessageQueue.AddMessage(playerMsg3);
                LogFile.Log.LogEntryDebug(combatResultsMsg3, LogDebugLevel.Medium);

                return CombatResults.DefenderDamaged;
            }

            //Miss
            string combatResultsMsg2 = "MvP "  + this.Representation + " Dam: base: " + damage + " mod: " + damageModifier + " HP: " + player.Hitpoints + " miss";
            //string playerMsg2 = "The " + this.SingleDescription + " misses you.";
            string playerMsg2 = MissesPlayerCombatString();
            Game.MessageQueue.AddMessage(playerMsg2);
            LogFile.Log.LogEntryDebug(combatResultsMsg2, LogDebugLevel.Medium);

            return CombatResults.DefenderUnhurt;
        }
 /// <summary>
 /// Do nothing here
 /// </summary>
 public override void IncrementTime(Player target)
 {
 }
Пример #20
0
 /// <summary>
 /// Carries out the start effects on the target. Many standard effects just use the stat modifier virtual functions.
 /// </summary>
 public abstract void OnStart(Player target);
Пример #21
0
 private void DrawEnergyBar(Player player, Point shieldOffset, int shieldBarFirstBar)
 {
     for (int i = 0; i < shieldBarFirstBar; i++)
     {
         if (i < shieldBarFirstBar)
         {
             PutChar(statsDisplayTopLeft.x + shieldOffset.x + 5 + i, statsDisplayTopLeft.y + shieldOffset.y, batteryChar, batteryActivatedColor);
         }
         else
         {
             PutChar(statsDisplayTopLeft.x + shieldOffset.x + 5 + i, statsDisplayTopLeft.y + shieldOffset.y, batteryChar, disabledColor);
         }
     }
 }
Пример #22
0
        private void DrawStats(Player player)
        {
            //Get screen handle
            RootConsole rootConsole = RootConsole.GetInstance();

            string hitpointsString = "HP: " + player.Hitpoints.ToString();
            string maxHitpointsString = "/" + player.MaxHitpoints.ToString();

            rootConsole.PrintLine(hitpointsString, statsDisplayTopLeft.x + hitpointsOffset.x, statsDisplayTopLeft.y + hitpointsOffset.y, LineAlignment.Left);
            rootConsole.PrintLine(maxHitpointsString, statsDisplayTopLeft.x + maxHitpointsOffset.x, statsDisplayTopLeft.y + maxHitpointsOffset.y, LineAlignment.Left);

            string speedString = "Sp: " + player.Speed.ToString();

            rootConsole.PrintLine(speedString, statsDisplayTopLeft.x + speedOffset.x, statsDisplayTopLeft.y + speedOffset.y, LineAlignment.Left);

            string ticksString = "Tk: " + Game.Dungeon.WorldClock.ToString();

            rootConsole.PrintLine(ticksString, statsDisplayTopLeft.x + worldTickOffset.x, statsDisplayTopLeft.y + worldTickOffset.y, LineAlignment.Left);

            string levelString = "Level: " + Game.Dungeon.Player.LocationLevel.ToString();

            rootConsole.PrintLine(levelString, statsDisplayTopLeft.x + levelOffset.x, statsDisplayTopLeft.y + levelOffset.y, LineAlignment.Left);
        }
Пример #23
0
 /// <summary>
 /// Process a player trying to close / seal this object.
 /// Returns true on success (implies the player cannot / walk on top of it)
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public abstract bool CloseLock(Player player);
 /// <summary>
 /// No duration effects normally have an empty OnEnd
 /// </summary>
 /// <param name="target"></param>
 public override void OnEnd(Player target)
 {
 }
Пример #25
0
 /// <summary>
 /// Process a player trying to open / clear this object.
 /// Returns true on success (implies the player can pass / walk on top of it)
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public abstract bool OpenLock(Player player);
Пример #26
0
 public PlayerEffectInstant(Player player)
     : base(player)
 {
 }
Пример #27
0
 public override CombatResults AttackPlayer(Player player)
 {
     return CombatResults.NeitherDied;
 }