Exemplo n.º 1
0
 public static void Engage(Character actor, Character target)
 {
     /*
      * if (actor.Character.HasToken("havingsex"))
      *      throw new Exception(string.Format("Actor ({0}) already having sex.", actor.Character.ToString()));
      * if (target.Character.HasToken("havingsex"))
      *      throw new Exception(string.Format("Target ({0}) already having sex.", target.Character.ToString()));
      */
     if (actor != target)
     {
         actor.RemoveAll("havingsex");
         target.RemoveAll("havingsex");
         actor.AddToken("havingsex", 0, target.ID);
         target.AddToken("havingsex", 0, actor.ID);
         actor.AddToken("havingsex_initsex", 0, target.ID);
         target.AddToken("havingsex_initsex", 0, actor.ID);
     }
     else
     {
         actor.RemoveAll("havingsex");
         actor.AddToken("havingsex", 0, target.ID);
         actor.AddToken("havingsex_initsex", 0, target.ID);
     }
 }
Exemplo n.º 2
0
        public override bool Hurt(float damage, string cause, object aggressor, bool finishable = false, bool leaveCorpse = true)
        {
            if (AutoTravelling)
            {
                NoxicoGame.AddMessage(i18n.Format("autotravelstop"));
                AutoTravelling = false;
            }

            if (Character.HasItemEquipped("eternitybrooch"))
            {
                var brooch = Character.GetEquippedItemBySlot("neck");                 //can assume the neck slot has the brooch.
                var today  = NoxicoGame.InGameTime.DayOfYear;
                if (!brooch.HasToken("lastTrigger"))
                {
                    brooch.AddToken("lastTrigger", today - 2);
                }
                if (Math.Abs(brooch.GetToken("lastTrigger").Value - today) >= 2 && Character.Health - damage <= 0)
                {
                    brooch.GetToken("lastTrigger").Value = today;
                    NoxicoGame.AddMessage(i18n.GetString("eternitybrooched"));
                    Character.Health = Character.MaximumHealth;
                    Reposition();
                    return(false);
                }
            }

            var dead = base.Hurt(damage, cause, aggressor, finishable);

            if (dead)
            {
                if (aggressor != null && aggressor is BoardChar)
                {
                    var aggChar  = ((BoardChar)aggressor).Character;
                    var relation = Character.Path("ships/" + aggChar.ID);
                    if (relation == null)
                    {
                        relation = new Token(aggChar.ID);
                        Character.Path("ships").Tokens.Add(relation);
                    }
                    relation.AddToken("killer");
                    if (aggChar.HasToken("stolenfrom"))
                    {
                        var myItems     = Character.GetToken("items").Tokens;
                        var hisItems    = aggChar.GetToken("items").Tokens;
                        var stolenGoods = myItems.Where(t => t.HasToken("owner") && t.GetToken("owner").Text == aggChar.ID).ToList();
                        foreach (var item in stolenGoods)
                        {
                            hisItems.Add(item);
                            myItems.Remove(item);
                        }
                        aggChar.GetToken("stolenfrom").Name = "wasstolenfrom";
                        aggChar.RemoveToken("hostile");
                    }
                }

                if (Lives == 0)
                {
                    Character.AddToken("gameover");
                    NoxicoGame.AddMessage(i18n.GetString("gameover_title"), Color.Red);
                    //var playerFile = Path.Combine(NoxicoGame.SavePath, NoxicoGame.WorldName, "player.bin");
                    //File.Delete(playerFile);
                    var world = string.Empty;
                    if (NoxicoGame.WorldName != "<Testing Arena>")
                    {
                        world = System.IO.Path.Combine(NoxicoGame.SavePath, NoxicoGame.WorldName);
                    }
                    NoxicoGame.Sound.PlayMusic("set://Death");
                    NoxicoGame.InGame = false;
                    var c = i18n.GetString(cause + "_player");
                    if (c[0] == '[')
                    {
                        c = i18n.GetString(cause);
                    }
                    MessageBox.Ask(
                        i18n.Format("youdied", c),
                        () =>
                    {
                        Character.CreateInfoDump();
                        if (NoxicoGame.WorldName != "<Testing Arena>")
                        {
                            Directory.Delete(world, true);
                        }
                        NoxicoGame.HostForm.Close();
                    },
                        () =>
                    {
                        if (NoxicoGame.WorldName != "<Testing Arena>")
                        {
                            Directory.Delete(world, true);
                        }
                        NoxicoGame.HostForm.Close();
                    }
                        );
                }
                else
                {
                    Respawn();
                }
            }
            return(dead);
        }
Exemplo n.º 3
0
        public override void Update()
        {
            //base.Update();
            if (NoxicoGame.Mode != UserMode.Walkabout)
            {
                return;
            }

            //START
            if (NoxicoGame.IsKeyDown(KeyBinding.Pause) || Vista.Triggers == XInputButtons.Start)
            {
                NoxicoGame.ClearKeys();
                Pause.Open();
                return;
            }

            var increase = 200 + (int)Character.GetStat("speed");

            if (Character.HasToken("haste"))
            {
                increase *= 2;
            }
            else if (Character.HasToken("slow"))
            {
                increase /= 2;
            }
            Energy += increase;
            if (Energy < 5000)
            {
                var wasNight = Toolkit.IsNight();

                NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddMilliseconds(increase);

                if (wasNight && !Toolkit.IsNight())
                {
                    ParentBoard.UpdateLightmap(this, true);
                    ParentBoard.Redraw();
                }
                EndTurn();
                return;
            }
            else
            {
                if (!NoxicoGame.PlayerReady)
                {
                    NoxicoGame.AgeMessages();
                }
                NoxicoGame.PlayerReady = true;
                Energy = 5000;
            }

            CheckForTimedItems();
            CheckForCopiers();
            if (Character.UpdateSex())
            {
                return;
            }

            var sleeping = Character.Path("sleeping");

            if (sleeping != null)
            {
                Character.Heal(2);
                sleeping.Value--;
                if (sleeping.Value <= 0)
                {
                    Character.RemoveToken("sleeping");
                    Character.RemoveToken("helpless");
                    NoxicoGame.AddMessage(i18n.GetString("yougetup"));
                }
                NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddMinutes(5);
                EndTurn();
                return;                 //07-04-13 no more sleepwalking
            }

            var helpless = Character.HasToken("helpless");

            if (helpless)
            {
                if (Random.NextDouble() < 0.05)
                {
                    Character.Heal(2);
                    NoxicoGame.AddMessage(i18n.GetString("yougetup"));
                    Character.RemoveToken("helpless");
                    helpless = false;
                }
            }
            var flying = Character.HasToken("flying");

#if DEBUG
            if (NoxicoGame.KeyMap[Keys.Z])
            {
                NoxicoGame.ClearKeys();
                NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddMinutes(30);
            }
#endif
            //Pause menu moved up so you can pause while <5000.

            //RIGHT
            if ((NoxicoGame.IsKeyDown(KeyBinding.Travel) || Vista.Triggers == XInputButtons.RightShoulder))
            {
                NoxicoGame.ClearKeys();
                if (!this.ParentBoard.AllowTravel)
                {
                    if (this.ParentBoard.BoardType == BoardType.Dungeon)
                    {
                        NoxicoGame.AddMessage(i18n.GetString("travel_notfromdungeon"));
                    }
                    else
                    {
                        NoxicoGame.AddMessage(i18n.GetString("travel_notfromwilds"));
                    }
                    return;
                }
                Travel.Open();
                return;
            }

            //LEFT
            if (NoxicoGame.IsKeyDown(KeyBinding.Rest) || Vista.Triggers == XInputButtons.LeftShoulder)
            {
                NoxicoGame.ClearKeys();
                Energy -= 1000;
                EndTurn();
                return;
            }

            //GREEN
            if (NoxicoGame.IsKeyDown(KeyBinding.Interact) || Vista.Triggers == XInputButtons.A)
            {
                NoxicoGame.ClearKeys();
                //NoxicoGame.Messages.Add("[Aim message]");
                NoxicoGame.Mode = UserMode.Aiming;
                NoxicoGame.Cursor.ParentBoard = this.ParentBoard;
                NoxicoGame.Cursor.XPosition   = this.XPosition;
                NoxicoGame.Cursor.YPosition   = this.YPosition;
                NoxicoGame.Cursor.PopulateTabstops();
                NoxicoGame.Cursor.Point();
                if (Character.HasToken("tutorial") && !Character.GetToken("tutorial").HasToken("interactmode"))
                {
                    Character.GetToken("tutorial").AddToken("dointeractmode");
                    NoxicoGame.CheckForTutorialStuff();
                }
                return;
            }

            //BLUE
            if (NoxicoGame.IsKeyDown(KeyBinding.Items) || Vista.Triggers == XInputButtons.X)
            {
                NoxicoGame.ClearKeys();
                NoxicoGame.Mode      = UserMode.Subscreen;
                NoxicoGame.Subscreen = Inventory.Handler;
                Subscreens.FirstDraw = true;
                return;
            }

            //YELLOW
            if ((NoxicoGame.IsKeyDown(KeyBinding.Fly) || Vista.Triggers == XInputButtons.Y) && !helpless)
            {
                NoxicoGame.ClearKeys();
                if (Character.HasToken("flying"))
                {
                    LandFromFlight();
                }
                else
                {
                    if (Character.HasToken("wings"))
                    {
                        if (Character.GetToken("wings").HasToken("small"))
                        {
                            NoxicoGame.AddMessage(i18n.GetString("wingsaretoosmall"));
                            return;
                        }
                        var tile = ParentBoard.Tilemap[XPosition, YPosition];
                        if (tile.Definition.Ceiling)
                        {
                            if (Character.GetStat("mind") < 10 ||
                                (Character.GetStat("mind") < 20 && Random.NextDouble() < 0.5))
                            {
                                Hurt(2, "death_crackedagainstceiling", null, false);
                                NoxicoGame.AddMessage(i18n.GetString("hittheceiling"));
                            }
                            else
                            {
                                NoxicoGame.AddMessage(i18n.GetString("cantflyinside"));
                            }
                            return;
                        }
                        //Take off
                        Character.AddToken("flying").Value = 100;
                        NoxicoGame.AddMessage(i18n.GetString("youfly"));
                        return;
                    }
                    NoxicoGame.AddMessage(i18n.GetString("flyneedswings"));
                }
                return;
            }

            //RED
            if ((NoxicoGame.IsKeyDown(KeyBinding.Activate) || Vista.Triggers == XInputButtons.B) && !helpless && !flying)
            {
                NoxicoGame.ClearKeys();

                if (OnWarp())
                {
                    CheckWarps();
                }

                var container = ParentBoard.Entities.OfType <Container>().FirstOrDefault(c => c.XPosition == XPosition && c.YPosition == YPosition);
                if (container != null)
                {
                    NoxicoGame.ClearKeys();
                    ContainerMan.Setup(container);
                    return;
                }

                //Find dropped items
                var itemsHere = DroppedItem.GetItemsAt(ParentBoard, XPosition, YPosition);
                if (itemsHere.Count == 1)
                {
                    var drop = itemsHere[0];
                    if (drop != null)
                    {
                        drop.Take(this.Character, ParentBoard);
                        NoxicoGame.Me.Player.Energy -= 1000;
                        NoxicoGame.AddMessage(i18n.Format("youpickup_x", drop.Item.ToString(drop.Token, true)));
                        NoxicoGame.Sound.PlaySound("set://GetItem");
                        ParentBoard.Redraw();
                        return;
                    }
                }
                else if (itemsHere.Count > 1)
                {
                    DroppedItem.PickItemsFrom(itemsHere);
                    return;
                }

                //Find bed
                //var bed = ParentBoard.Entities.OfType<Clutter>().FirstOrDefault(c => c.XPosition == XPosition && c.YPosition == YPosition && c.Glyph == 0x147);
                var bed = ParentBoard.Entities.OfType <Clutter>().FirstOrDefault(c => c.XPosition == XPosition && c.YPosition == YPosition && c.DBRole == "bed");
                if (bed != null)
                {
                    var prompt  = "It's " + NoxicoGame.InGameTime.ToShortTimeString() + ", " + NoxicoGame.InGameTime.ToLongDateString() + ". Sleep for how long?";
                    var options = new Dictionary <object, string>();
                    foreach (var interval in new[] { 1, 2, 4, 8, 12 })
                    {
                        options[interval] = Toolkit.Count(interval).Titlecase() + (interval == 1 ? " hour" : " hours");
                    }
                    options[-1] = "Cancel";
                    MessageBox.List(prompt, options, () =>
                    {
                        if ((int)MessageBox.Answer != -1)
                        {
                            Character.AddToken("helpless");
                            Character.AddToken("sleeping").Value = (int)MessageBox.Answer * 12;
                        }
                    }, true, true, i18n.GetString("Bed"));
                }
                return;
            }

#if DEBUG
            if (NoxicoGame.KeyMap[Keys.F3])
            {
                NoxicoGame.ClearKeys();
                ParentBoard.DumpToHtml(string.Empty);
                NoxicoGame.AddMessage("Board dumped.");
                return;
            }
#endif
            if (helpless)
            {
                EndTurn();
                return;
            }

            if (!AutoTravelling)
            {
                if (NoxicoGame.IsKeyDown(KeyBinding.Left) || Vista.DPad == XInputButtons.Left)
                {
                    this.Move(Direction.West);
                }
                else if (NoxicoGame.IsKeyDown(KeyBinding.Right) || Vista.DPad == XInputButtons.Right)
                {
                    this.Move(Direction.East);
                }
                else if (NoxicoGame.IsKeyDown(KeyBinding.Up) || Vista.DPad == XInputButtons.Up)
                {
                    this.Move(Direction.North);
                }
                else if (NoxicoGame.IsKeyDown(KeyBinding.Down) || Vista.DPad == XInputButtons.Down)
                {
                    this.Move(Direction.South);
                }
                //And now, attempting to fire a long range weapon in a cardinal.
                else if (NoxicoGame.IsKeyDown(KeyBinding.ShootLeft))
                {
                    this.QuickFire(Direction.West);
                }
                else if (NoxicoGame.IsKeyDown(KeyBinding.ShootRight))
                {
                    this.QuickFire(Direction.East);
                }
                else if (NoxicoGame.IsKeyDown(KeyBinding.ShootUp))
                {
                    this.QuickFire(Direction.North);
                }
                else if (NoxicoGame.IsKeyDown(KeyBinding.ShootDown))
                {
                    this.QuickFire(Direction.South);
                }
            }
            else
            {
                if (NoxicoGame.IsKeyDown(KeyBinding.Left) || NoxicoGame.IsKeyDown(KeyBinding.Right) || NoxicoGame.IsKeyDown(KeyBinding.Up) || NoxicoGame.IsKeyDown(KeyBinding.Down))                //(NoxicoGame.KeyMap[(int)Keys.Left] || NoxicoGame.KeyMap[(int)Keys.Right] || NoxicoGame.KeyMap[(int)Keys.Up] || NoxicoGame.KeyMap[(int)Keys.Down])
                {
                    AutoTravelling = false;
                    return;
                }
                var x   = XPosition;
                var y   = YPosition;
                var dir = Direction.North;
                if (AutoTravelMap.RollDown(y, x, ref dir))
                {
                    Move(dir);
                }
                else
                {
                    AutoTravelling = false;
                    if ((int)AutoTravelLeave > -1)
                    {
                        this.Move(AutoTravelLeave);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public List <bool> Apply(Character target)
        {
            List <bool> returns = new List <bool>();

            foreach (Token change in this.Tokens)
            {
                if (change.Name.StartsWith("!"))
                {
                    change.Name = change.Name.Substring(1);
                    foreach (Token checktoken in target.Tokens)
                    {
                        if (checktoken.Equals(change))
                        {
                            target.RemoveToken(checktoken);
                            returns.Add(true);
                            break;
                        }
                    }
                    returns.Add(false);
                }
                else
                {
                    switch (change.Name)
                    {
                    case "deltaBreastSize":
                        target.FixBoobs();
                        target.GetToken("breasts").GetToken("size").Value += change.GetToken("size").Value;
                        returns.Add(true);
                        break;

                    case "deltaBreastNum":
                        target.FixBoobs();
                        target.GetToken("breasts").GetToken("amount").Value += change.GetToken("amount").Value;
                        returns.Add(true);
                        break;

                    case "dicknipples":
                        target.FixBoobs();
                        var nips = target.GetToken("breasts").GetToken("nipples");
                        if (nips != null)
                        {
                            if (!nips.HasToken("canfuck"))
                            {
                                nips.RemoveToken("fuckable");
                                nips.RemoveToken("wetness");
                                nips.RemoveToken("looseness");
                                nips.AddToken("canfuck");
                                nips.AddToken("length", change.GetToken("length").Value);
                                nips.AddToken("thickness", change.GetToken("thickness").Value);
                                returns.Add(true);
                            }
                            else
                            {
                                returns.Add(false);
                            }
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "nipplecunts":
                        nips = target.GetToken("breasts").GetToken("nipples");
                        if (nips != null)
                        {
                            if (!nips.HasToken("fuckable"))
                            {
                                nips.RemoveToken("canfuck");
                                nips.RemoveToken("length");
                                nips.RemoveToken("thickness");
                                nips.AddToken("fuckable");
                                nips.AddToken("wetness", change.GetToken("wetness").Value);
                                nips.AddToken("looseness", change.GetToken("looseness").Value);
                                returns.Add(true);
                            }
                            else
                            {
                                returns.Add(false);
                            }
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "deltaCockLength":
                        if (target.HasToken("penis"))
                        {
                            target.GetToken("penis").GetToken("length").Value += change.GetToken("length").Value;
                            returns.Add(true);
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "deltaCockThickness":
                        if (target.HasToken("penis"))
                        {
                            target.GetToken("penis").GetToken("thickness").Value += change.GetToken("thickness").Value;
                            returns.Add(true);
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "deltaNippleSize":
                        target.FixBoobs();
                        if (target.GetToken("breasts").HasToken("nipples"))
                        {
                            target.GetToken("breasts").GetToken("nipples").GetToken("size").Value += change.GetToken("size").Value;
                            returns.Add(true);
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "deltaNippleNumber":
                        target.FixBoobs();
                        var boobs = target.GetToken("breasts");
                        if (boobs.HasToken("nipples"))
                        {
                            boobs.GetToken("nipples").Value += change.GetToken("amount").Value;
                            if (boobs.GetToken("nipples").Value <= 0)
                            {
                                boobs.RemoveToken("nipples");
                            }
                        }
                        else
                        {
                            boobs.AddToken("nipples", change.GetToken("amount").Value).AddToken("size", 0.5f);
                        }
                        returns.Add(true);
                        break;

                    case "taur":
                        if (!target.HasToken("taur"))
                        {
                            target.AddToken("taur", (int)change.Value + target.GetToken("quadruped").Value);
                            target.RemoveToken("snaketail");
                            target.RemoveToken("slimeblob");
                            target.RemoveToken("quadruped");
                            target.FixBroken();
                            returns.Add(true);
                        }
                        else
                        {
                            target.GetToken("taur").Value += (int)change.Value;
                            if (target.GetToken("taur").Value <= 0)
                            {
                                target.RemoveToken("taur");
                                target.FixBroken();
                            }
                            returns.Add(true);
                        }
                        break;

                    case "snaketail":
                        if (!target.HasToken("snaketail"))
                        {
                            target.RemoveToken("taur");
                            target.RemoveToken("slimeblob");
                            target.RemoveToken("quadruped");
                            target.AddToken("snaketail");
                            target.FixBroken();
                            returns.Add(true);
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "quadruped":
                        if (!target.HasToken("quadruped"))
                        {
                            target.AddToken("quadruped", change.Value + target.GetToken("taur").Value);
                            target.RemoveToken("taur");
                            target.RemoveToken("slimeblob");
                            target.RemoveToken("snaketail");
                            target.FixBroken();
                            returns.Add(true);
                        }
                        else
                        {
                            target.GetToken("quadruped").Value += (int)change.Value;
                            if (target.GetToken("quadruped").Value <= 0)
                            {
                                target.RemoveToken("quadruped");
                                target.FixBroken();
                            }
                            returns.Add(true);
                        }
                        break;

                    case "slimeblob":
                        if (!target.HasToken("slimeblob"))
                        {
                            target.RemoveToken("taur");
                            target.RemoveToken("snaketail");
                            target.RemoveToken("quadruped");
                            target.AddToken("slimeblob");
                            target.FixBroken();
                            returns.Add(true);
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "normalLegs":
                        if (target.HasToken("taur") || target.HasToken("snaketail") || target.HasToken("slimeblob") || target.HasToken("quadruped"))
                        {
                            target.RemoveToken("taur");
                            target.RemoveToken("snaketail");
                            target.RemoveToken("quadruped");
                            target.RemoveToken("slimeblob");
                            target.FixBroken();
                            returns.Add(true);
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "deltaBalls":
                        if (target.HasToken("balls"))
                        {
                            target.GetToken("balls").GetToken("amount").Value += change.GetToken("amount").Value;
                            returns.Add(true);
                        }
                        else
                        {
                            if (change.GetToken("amount").Value > 0)
                            {
                                target.AddToken("balls").AddToken("amount", (int)change.GetToken("amount").Value);
                                returns.Add(true);
                            }
                            else
                            {
                                returns.Add(false);
                            }
                        }
                        target.FixBroken();
                        break;

                    case "deltaBallSize":
                        if (target.HasToken("balls"))
                        {
                            target.GetToken("balls").GetToken("size").Value += change.GetToken("size").Value;
                            target.FixBroken();
                            returns.Add(true);
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    case "deltaEyes":
                        target.GetToken("eyes").GetToken("count").Value += (int)change.GetToken("count").Value;
                        returns.Add(true);
                        break;

                    case "legs":
                        if (target.HasToken("legs"))
                        {
                            if (target.GetToken("legs").Text == change.Text)
                            {
                                returns.Add(false);
                            }
                            else
                            {
                                returns.Add(true);
                            }
                            target.GetToken("legs").Text = change.Text;
                        }
                        else
                        {
                            returns.Add(false);
                        }
                        break;

                    default:
                        target.AddToken(change);
                        returns.Add(true);
                        break;
                    }
                }
            }
            return(returns);
        }