コード例 #1
0
    // get the next valid destination for player
    public int obtainTheNextDestination(You player)
    {
        if (this.isConditional == false)
        {
            Debug.Log(this.defaultDestination);
            return(this.defaultDestination);
        }

        ProgressionStats currentPlayerProgression = player.yourProgression;
        ProgressionStats nextProgressionCondition;

        // go through the list of possible destination one by one, the first match is the next destination
        // NOTE: list of possible destination need to be in descending order of more requirement to less requirement
        Debug.Log("checking");
        for (int i = 0; i < this.possibleDestinationList.Count; i++)
        {
            nextProgressionCondition = this.possibleDestinationList [i].Key;

            if (isValidDestination(currentPlayerProgression, nextProgressionCondition))
            {
                return(this.possibleDestinationList [i].Value);
            }
        }

        return(defaultDestination);
    }
コード例 #2
0
        public void Test_LightInjuriesHealOverTime()
        {
            var you  = YouInARoom(out IWorld world);
            var room = you.CurrentLocation;

            var a = new You("You", room);

            //give them an injury
            var injury = new Injured("Bruised Shin", a, 10, InjuryRegion.Leg, world.InjurySystems.First(i => i.IsDefault));

            a.Adjectives.Add(injury);

            for (int i = 0; i < 11; i++)
            {
                var stack = new ActionStack();
                stack.RunStack(world, GetUI(typeof(object)), new DoNothingAction(you), a, a.GetFinalBehaviours());

                //after 9 round you should still be injured
                if (i < 10)
                {
                    Assert.Contains(injury, a.Adjectives.ToArray(), $"unexpected injury healing on round {i}");
                }
                else
                {
                    //on 10th round it should be gone
                    Assert.IsFalse(a.Adjectives.Contains(injury));
                }
            }
        }
コード例 #3
0
ファイル: MoneyTests.cs プロジェクト: tznind/Wanderer
        public void Test_MoneyStacking()
        {
            var world = new World();
            var room  = new Room("SomeRoom", world, 'f');
            var you   = new You("Dave", room);

            world.Map.Add(new Point3(0, 0, 0), room);

            var money = new ItemStack("Money", 10).With(Stat.Value, 1);

            room.Items.Add(money);

            Assert.AreEqual(10, money.GetFinalStats(you)[Stat.Value], "Money has worth depending on stack size");
            Assert.AreEqual(0, money.GetFinalStats(you)[Stat.Fight], "Money doesn't help you fight");

            var money2 = new ItemStack("Money", 10).With(Stat.Value, 1);

            room.Items.Add(money2);

            //pick both up
            world.RunRound(new FixedChoiceUI((IItem)money), you.GetFinalActions().OfType <PickUpAction>().First());
            world.RunRound(new FixedChoiceUI((IItem)money2), you.GetFinalActions().OfType <PickUpAction>().First());

            // you only have 1 item which has all the Money
            Assert.AreSame(money, you.Items.Single());
            Assert.AreEqual(20, money.StackSize);
            Assert.AreEqual(20, money.GetFinalStats(you)[Stat.Value]);
        }
コード例 #4
0
ファイル: RoomFactoryTests.cs プロジェクト: tznind/Wanderer
        public void TestCreatingRoomFromBlueprint_WithDialogue()
        {
            var yaml = @"- Name: Gun Bay
  Dialogue:
    Next: 193506ab-11bc-4de2-963e-e2f55a38d006";

            var roomFactory = new RoomFactory {
                Blueprints = Compiler.Instance.Deserializer.Deserialize <List <RoomBlueprint> >(yaml)
            };

            var w = new World();

            w.Dialogue.AllDialogues.Add(new DialogueNode()
            {
                Identifier = new Guid("193506ab-11bc-4de2-963e-e2f55a38d006"),
                Body       = new List <TextBlock> {
                    new TextBlock("This room is rank"),
                }
            });

            var room = roomFactory.Create(w, roomFactory.Blueprints.Single());

            w.Map.Add(new Point3(0, 0, 0), room);

            var you = new You("Wanderer", room);

            var ui = GetUI("look:Gun Bay");

            w.RunRound(ui, you.GetFinalActions().OfType <DialogueAction>().Single());

            Assert.Contains("This room is rank", ui.MessagesShown);
        }
コード例 #5
0
 void Awake()
 {
     monster       = GameObject.Find("Monster").GetComponent <Monster>();
     you           = GameObject.Find("You").GetComponent <You>();
     monsterPoints = 0;
     playerPoints  = 0;
     operators     = new int[3];
 }
コード例 #6
0
        protected You YouInARoom(out IWorld world)
        {
            var room = InARoom(out world);
            var you  = new You("Test Wanderer", room);

            WorldFactory.AddDefaults(world, you);
            return(you);
        }
コード例 #7
0
ファイル: ViewModel.cs プロジェクト: longde123/grove
 public void Dispose()
 {
     ManaPool.Dispose();
     YourBattlefield.Dispose();
     OpponentsBattlefield.Dispose();
     Zones.Dispose();
     You.Dispose();
     Opponent.Dispose();
 }
コード例 #8
0
        protected void TwoInARoom(out You you, out IActor them, out IWorld w)
        {
            you = YouInARoom(out w);

            them = new Npc("Chaos Sam", you.CurrentLocation);

            //don't wonder off Chaos Sam
            them.BaseActions.Remove(new LeaveAction(you));
        }
コード例 #9
0
        public void Test_DarkRoom()
        {
            InARoom(out IWorld world);

            var darkRoom = new Room("Dark Room", world, '-');

            world.AdjectiveFactory.Create(world, darkRoom, "Dark");

            Assert.IsTrue(darkRoom.Has("Dark"));

            world.Map.Clear();
            world.Map.Add(new Point3(0, 0, 0), darkRoom);

            var globe = new Item("Glo Globe");

            globe.Adjectives.Add(world.AdjectiveFactory.Create(world, globe, "Light"));
            darkRoom.Items.Add(globe);

            var you = new You("Wanderer", darkRoom);

            you.BaseStats[Stat.Fight] = 20;

            Assert.AreEqual(10, you.GetFinalStats()[Stat.Fight], "Expect fight to be at penalty due to room being dark");
            Assert.AreEqual(0, you.Items.Count);
            Assert.AreEqual(1, you.CurrentLocation.Items.Count);

            var stack = new ActionStack();

            stack.RunStack(world, new FixedChoiceUI(globe), new PickUpAction(globe), you, new IBehaviour[0]);

            Assert.AreEqual(1, you.Items.Count);
            Assert.AreEqual(0, you.CurrentLocation.Items.Count);
            Assert.AreEqual(20, you.GetFinalStats()[Stat.Fight], "Expect fight to be back to normal now that you ignore dark");

            //2+ light globes shouldn't boost your fight above the baseline
            var globe2 = new Item("Glo Globe");

            globe2.Adjectives.Add(world.AdjectiveFactory.Create(world, globe2, "Light"));

            you.Items.Add(globe2);

            Assert.AreEqual(2, you.Items.Count);
            Assert.AreEqual(0, you.CurrentLocation.Items.Count);
            Assert.AreEqual(20, you.GetFinalStats()[Stat.Fight], "Expect fight to be back to normal now since multiple globes shouldn't stack");



            darkRoom.Adjectives.Clear();

            Assert.AreEqual(20, you.GetFinalStats()[Stat.Fight], "Expect fight to stay 20 because lights don't help when it's not dark");

            you.Items.Clear();
            Assert.AreEqual(20, you.GetFinalStats()[Stat.Fight], "Now that it is light the torch doesn't matter");
        }
コード例 #10
0
ファイル: MoneyTests.cs プロジェクト: tznind/Wanderer
        public void Test_RustyDoesNotImproveNegativeValue()
        {
            var you = new You("Dave", new Room("SomeRoom", new World(), 'f'));

            var cog = new Item("CursedCog").With(Stat.Value, -10);

            cog.Adjectives.Add(new Adjective(cog)
            {
                Name = "Rusty", StatsRatio = { [Stat.Value] = 0.5 },
            });

            Assert.AreEqual(-20, cog.GetFinalStats(you)[Stat.Value]);
        }
コード例 #11
0
ファイル: MoneyTests.cs プロジェクト: tznind/Wanderer
        public void Test_RustyReducesValue()
        {
            var you = new You("Dave", new Room("SomeRoom", new World(), 'f'));

            var cog = new Item("Cog").With(Stat.Value, 10);

            cog.Adjectives.Add(new Adjective(cog)
            {
                Name = "Rusty", StatsRatio = { [Stat.Value] = 0.5 },
            });

            Assert.AreEqual(5, cog.GetFinalStats(you)[Stat.Value]);
        }
コード例 #12
0
ファイル: MoneyTests.cs プロジェクト: tznind/Wanderer
        public void Test_RustyMoney()
        {
            var world = new World();
            var you   = new You("Dave", new Room("SomeRoom", world, 'f'));

            var money = new ItemStack("money", 10).With(Stat.Value, 1);

            money.Adjectives.Add(new Adjective(money)
            {
                Name       = "Rusty",
                IsPrefix   = true,
                StatsRatio = new StatsCollection(0.5)
            });

            Assert.AreEqual(5, money.GetFinalStats(you)[Stat.Value], "Money has worth depending on stack size");
        }
コード例 #13
0
ファイル: Hook.cs プロジェクト: zhangsiqi1018/Crazy-Collector
    private void Awake()
    {
        GameObject you = GameObject.Find("You");

        center  = you.transform.position;
        youInfo = you.GetComponent <You>();

        w         = 0;
        r         = 0.6f;
        launchR   = 10f;
        direction = +1;

        baseSpeed = 1.5f;

        rRate       = 1.3f;
        rotateSpeed = rRate * baseSpeed;

        lRate     = 4.2f;
        outSpeed  = lRate * baseSpeed;
        backSpeed = 1.4f * outSpeed;


        isShooting   = false;
        isRetracting = false;

        LButton = (Button)GameObject.Find("LeftButton").GetComponent(typeof(Button));
        RButton = (Button)GameObject.Find("RightButton").GetComponent(typeof(Button));

        HButton   = (Button)GameObject.Find("HookButton").GetComponent(typeof(Button));
        EButton   = (Button)GameObject.Find("EnergyButton").GetComponent(typeof(Button));
        HReleased = true;
        EReleased = true;

        energyScale = new Vector3(0.2f, 0.2f, 0);
        energySpeed = 4f;
        imageSize   = new Rect(0, 0, 225, 224);
        imagePivot  = new Vector2(0f, 0f);
        imagePath   = "";

        tagEnergy = "Energy";
        //tagChar = "Char";

        status = GameObject.Find("Status").GetComponent <Status>();
    }
コード例 #14
0
    private void Awake()
    {
        //collectedChars = GameObject.Find("CollectedChars").GetComponent<Text>();
        collectedNumber   = 0;
        collectedPartsNum = 0;

        effectNote = GameObject.Find("EffectNote").GetComponent <Text>();
        noteTime   = 0;

        sentenceCounter = GameObject.Find("SentenceCounter").GetComponent <Text>();

        timeCounter = GameObject.Find("TimeCounter").GetComponent <Text>();
        second      = 0;
        minute      = 0;
        realTime    = 0;

        heartNumber = GameObject.Find("HeartNumber").GetComponent <Text>();
        enterButton = GameObject.Find("EnterButton").GetComponent <Button>();
        escButton   = GameObject.Find("EscButton").GetComponent <Button>();
        escReleased = true;

        enableEnter = false;
        enableEsc   = false;

        you         = GameObject.Find("You").GetComponent <You>();
        scoreManger = GameObject.Find("ScoreManger").GetComponent <ScoreManger>();

        resetTime = 0;
        //Find operators
        operators    = new Text[3];
        operators[0] = GameObject.Find("FirstOperator").GetComponent <Text>();
        operators[1] = GameObject.Find("SecondOperator").GetComponent <Text>();
        operators[2] = GameObject.Find("ThirdOperator").GetComponent <Text>();

        comparator = GameObject.Find("Comparator").GetComponent <Text>();
    }
コード例 #15
0
 public int getNextNode(You player)
 {
     return(this.obtainTheNextDestination(player));
 }
コード例 #16
0
        /// <summary>
        /// Creates a relationship of strength <paramref name="intensity"/> which is how strongly
        /// <paramref name="them"/> feels about <paramref name="you"/>
        /// </summary>
        /// <param name="attitude"></param>
        /// <param name="youFeelTheSameWay">If you feel the same back then two relationships will be created instead of one (i.e. in both directions)</param>
        /// <param name="you"></param>
        /// <param name="them"></param>
        /// <param name="w"></param>
        protected void TwoInARoomWithRelationship(double attitude, bool youFeelTheSameWay, out You you, out IActor them, out IWorld w)
        {
            TwoInARoom(out you, out them, out w);
            w.Relationships.Add(new PersonalRelationship(them, you)
            {
                Attitude = attitude
            });

            if (youFeelTheSameWay)
            {
                w.Relationships.Add(new PersonalRelationship(you, them)
                {
                    Attitude = attitude
                });
            }
        }