public void get_out_of_jail_free_card()
        {
            _card = _luckFactory.create("Community Chest: get out of jail free", false, 0);
            _card.LandOn(ref _player);

            Assert.AreEqual(_player.GetOutOfJailCardCount, 1);
        }
Exemplo n.º 2
0
 public void UpdateLuck()
 {
     LuckText.Text = (Player.BattleData.Luck * 100).ToString("0.0") + "%";
     if (Player.BattleData.Luck <= 0.25)
     {
         LuckText.Foreground = Brushes.Red;
     }
     else if (Player.BattleData.Luck <= 0.5)
     {
         LuckText.Foreground = Brushes.DarkOrange;
     }
     else if (Player.BattleData.Luck <= 0.75)
     {
         LuckText.Foreground = Brushes.YellowGreen;
     }
     else
     {
         LuckText.Foreground = Brushes.LimeGreen;
     }
     Luck.BeginAnimation(RangeBase.ValueProperty, new DoubleAnimation()
     {
         From           = Luck.Value,
         To             = Player.BattleData.Luck,
         Duration       = TimeSpan.FromSeconds(0.3),
         EasingFunction = new ExponentialEase()
         {
             EasingMode = EasingMode.EaseInOut
         }
     });
 }
Exemplo n.º 3
0
        private static (Room room, List <Point>, Direction direction) GetStartTiles(
            List <Room> rooms,
            List <Corridor> corridors,
            int corridorWidth,
            List <int> wideIndexList
            )
        {
            var minNumberOfCorridors = rooms.Min(room => room.Corridors.Count);
            var startRoomCanddiates  = (minNumberOfCorridors == 0)
                ? rooms.Where(room => room.Corridors.Count == 0).ToList()
                : rooms;

            var room           = startRoomCanddiates[Luck.Next(startRoomCanddiates.Count)];
            var availableTiles = new List <(List <Point> tiles, Direction direction)>();

            var upTilesList = GetUpOrDownStartTiles(room, rooms, corridors, corridorWidth, wideIndexList, upOrDown: true);

            upTilesList.ForEach(upTiles => availableTiles.Add((upTiles, Direction.UP)));

            var downTilesList = GetUpOrDownStartTiles(room, rooms, corridors, corridorWidth, wideIndexList, upOrDown: false);

            downTilesList.ForEach(downTiles => availableTiles.Add((downTiles, Direction.DOWN)));

            var leftTiles = GetLeftOrRightStartTiles(room, rooms, corridors, corridorWidth, wideIndexList, leftOrRight: true);

            leftTiles.ForEach(leftTiles => availableTiles.Add((leftTiles, Direction.LEFT)));

            var rightTilesList = GetLeftOrRightStartTiles(room, rooms, corridors, corridorWidth, wideIndexList, leftOrRight: false);

            rightTilesList.ForEach(rightTiles => availableTiles.Add((rightTiles, Direction.RIGHT)));

            if (!availableTiles.Any())
            {
                return(default, default, default);
Exemplo n.º 4
0
        /// <inheritdoc/>
        public void WriteDataToStream(BinaryWriter writer)
        {
            EarthboundPlainTextEncoding PlainTextEncoding = new EarthboundPlainTextEncoding();

            writer.Write(PlainTextEncoding.GetBytesPadded(Name, 5));
            writer.Write(Level);
            writer.Write(Experience);
            writer.Write(HP.MaxValue);
            writer.Write(PP.MaxValue);
            writer.Write((byte)PermanentStatusEffect);
            writer.Write((byte)PossessionStatus);
            writer.Write((byte)BattleStatusEffect);
            writer.Write(FeelingStrange);
            writer.Write(CantConcentrateTurns);
            writer.Write(Homesick);
            //TODO: Shield
            Offense.WriteDataToStream(writer);
            Defense.WriteDataToStream(writer);
            Speed.WriteDataToStream(writer);
            Guts.WriteDataToStream(writer);
            Luck.WriteDataToStream(writer);
            Vitality.WriteDataToStream(writer);
            IQ.WriteDataToStream(writer);
            Inventory.WriteDataToStream(writer);
            HP.WriteDataToStream(writer);
            PP.WriteDataToStream(writer);
            throw new NotImplementedException("Weaknesses, miss rates, permanent boosts, shields, etc");
        }
        public void get_out_of_jail_free_card()
        {
            _card = _luckFactory.create("Community Chest: get out of jail free", false, 0);
            _card.LandOn(ref _player);

            Assert.AreEqual(_player.GetOutOfJailCardCount, 1);
        }
Exemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     StartCoroutine(SetMoves());
     //MoveId1 = Random.Range(1, 6);
     //MoveId2 = Random.Range(6, 11);
     //MoveId3 = Random.Range(11, 16);
     //MoveId4 = Random.Range(16, 21);
     name = "The Player";
     //    es = Enemy.GetComponent<EnemyScr>();
     //we are going to want to start the player off with two random moves, one to attack, one to defend
     Stuntime        = -1;
     Muck            = -1;
     IsCharacterTurn = true;
     StartAtk        = 10;
     StartDef        = 10;
     StartLuck       = 10;
     AtkText.text    = "Atk X " + Atk.ToString();
     DefText.text    = "Def X " + Def.ToString();
     LuckText.text   = "Luck X " + Luck.ToString();
     LvlText.text    = "Lvl X " + Lvl.ToString();
     ChipsText.text  = "Chips X " + Chips.ToString();
     //   MoveId1 = 0; //id for first move
     // MoveId2 = 0; //id for second move
     // MoveId3 = 0; //id for third move
     // MoveId4 = 0; //id for fourth move
 }
Exemplo n.º 7
0
 public GameContext(int maxGameStepsWithoutRender, int gameFPS = 60, int uxFPS = 60)
 {
     GameSeed  = Luck.Reset();
     GameFPS   = gameFPS;
     UxFPS     = uxFPS;
     GameTicks = TICKS_IN_A_SECOND / gameFPS;
     UxTicks   = TICKS_IN_A_SECOND / uxFPS;
     MaxGameStepsWithoutRender = maxGameStepsWithoutRender;
 }
        public void go_to_jail_card()
        {
            _card = _luckFactory.create("Chance: go to jail", false, 0);
            _card.LandOn(ref _player);
            var playersLocation = Board.Access().GetProperty(_player.GetLocation());
            var jail = Board.Access().GetProperty(10);

            Assert.AreEqual(playersLocation, jail);
            Assert.IsTrue(_player.IsInJail);
        }
 public void testLuck()
 {
     //create instance of factory
     LuckFactory f = new LuckFactory();
     //create instance from factory
     Luck p = f.create("Luck", true, 50) ;
     //check that it is right type
     Type t = new Luck().GetType();
     Assert.IsInstanceOfType(t, p);
 }
Exemplo n.º 10
0
        public override string Use(int itemPos, User user, string channel)
        {
            base.Use(itemPos, user, channel);

            var effect = new Luck();

            _effectRepository.AddEffect(user, Luck.EffectId, DurationInMinutes);

            return(string.Format(DougMessages.AddedEffect, effect.Name, DurationInMinutes));
        }
        public void go_to_jail_card()
        {
            _card = _luckFactory.create("Chance: go to jail", false, 0);
            _card.LandOn(ref _player);
            var playersLocation = Board.Access().GetProperty(_player.GetLocation());
            var jail            = Board.Access().GetProperty(10);

            Assert.AreEqual(playersLocation, jail);
            Assert.IsTrue(_player.IsInJail);
        }
            public void test_luck()
            {
                //testing empty constructor
                var emptyLuck = new Luck();

                //create instance using factory
                var luck = _luckFactory.create("Luck", true, 50);

                // Assert that instance created is of luck type
                Assert.IsInstanceOf <Luck>(luck);
                Assert.IsInstanceOf <Luck>(emptyLuck);
            }
            public void test_luck()
            {
                //testing empty constructor
                var emptyLuck = new Luck();

                //create instance using factory
                var luck = _luckFactory.create("Luck", true, 50);

                // Assert that instance created is of luck type
                Assert.IsInstanceOf<Luck>(luck);
                Assert.IsInstanceOf<Luck>(emptyLuck);
            }
Exemplo n.º 14
0
        public void TestLandon()
        {
            Luck   luck   = new Luck();
            Player player = new Player();

            luck.landOn(ref player);
            Assert.AreEqual(1550, player.getBalance());

            Luck luck1 = new Luck("Bad", false, 50);

            luck1.landOn(ref player);
            Assert.AreEqual(1500, player.getBalance());
        }
Exemplo n.º 15
0
 private void Start()
 {
     luck                       = new Luck("Luck", Stat.StatType.LUCK, Stat.Rarity.RARE, Stat.AffectedStat.RARITY, 0);
     dexterity                  = new Dexterity("Dexterity", Stat.StatType.DEXTERITY, Stat.Rarity.UNCOMMON, Stat.AffectedStat.ACCUMULATION, 0);
     intelligence               = new Intelligence("Intelligence", Stat.StatType.INTELLIGENCE, Stat.Rarity.COMMON, Stat.AffectedStat.THEME, 0);
     strength                   = new Strength("Strength", Stat.StatType.STRENGTH, Stat.Rarity.COMMON, Stat.AffectedStat.LOOT_AMOUNT, 0);
     playerName                 = "";
     level                      = 1;
     lootBoxes                  = 1;
     maxLootBoxes               = 5;
     inventorySlots             = 12;
     weaponSlots                = 2;
     experienceToNext           = 100;
     lastLootBoxAccumulatedTime = 100;
 }
        public void ShowInfo()
        {
            Console.WriteLine("\n\tINFO");

            Console.WriteLine("{0, -12}: {1, -15}", "Name", Name);
            Console.WriteLine("{0, -12}: {1, -15}", "Surname", Surname);
            Console.WriteLine("{0, -12}: {1, -15}", "Passport ID", PassportID);
            Console.WriteLine("{0, -12}: {1, -15}", "Gender", gender.ToString());
            Console.WriteLine("{0, -12}: {1, -15}", "DateBirth", date_of_birth.ToString("yyyy MMMM dd"));
            Console.WriteLine("{0, -12}: {1, -15}", "Age", Age.ToString() + " y.o");
            Console.WriteLine("{0, -12}: {1, -15}", "Weight", Weight.ToString() + " kg");
            Console.WriteLine("{0, -12}: {1, -15}", "Height", Height.ToString() + " cm\n");
            Console.WriteLine("{0, -12}: {1, -15}", "Experience", Expeience.ToString());
            Console.WriteLine("{0, -12}: {1, -15}", "Luck", Luck.ToString() + " %");
            Console.WriteLine("{0, -12}: {1, -15}", "Money", Money.ToString() + " $");
        }
Exemplo n.º 17
0
 public string Emocion3([FromBody] Luck luck)
 {
     if (luck.LuckId == 0)
     {
         return("sos una persona indiferente");
     }
     if (luck.LuckId == 1)
     {
         return("sos una persona feliz");
     }
     if (luck.LuckId == 3)
     {
         return("sos una persona muy aburrida");
     }
     return("estoy muy ocupado, no te puedo atender");
 }
Exemplo n.º 18
0
 public string Emocion_3([FromBody] Luck luck)
 {
     if (luck.luckID == 0)
     {
         return("Sos una persona indiferente");
     }
     if (luck.luckID == 1)
     {
         return("Sos una persona feliz");
     }
     if (luck.luckID == 3)
     {
         return("Sos una persona aburrida");
     }
     return("Estoy muy ocupado, no puedo atenderte en este instante");
 }
Exemplo n.º 19
0
        public virtual void ShowInfo()
        {
            Console.WriteLine("{0, -12}: {1, -15}", "Name", Name);
            Console.WriteLine("{0, -12}: {1, -15}", "Surname", Surname);
            Console.WriteLine("{0, -12}: {1, -15}", "Passport ID", PassportID);
            Console.WriteLine("{0, -12}: {1, -15}", "Gender", gender.ToString());
            Console.WriteLine("{0, -12}: {1, -15}", "DateBirth", date_of_birth.ToString("yyyy MMMM dd"));
            Console.WriteLine("{0, -12}: {1, -15}", "Age", Age.ToString() + " y.o");
            Console.WriteLine("{0, -12}: {1, -15}", "Weight", Weight.ToString() + " kg");
            Console.WriteLine("{0, -12}: {1, -15}", "Height", Height.ToString() + " cm");

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("{0, -12}: {1, -15}", "Experience", Experience.ToString());
            Console.WriteLine("{0, -12}: {1, -15}", "Luck", Luck.ToString() + " %");
            Console.WriteLine("{0, -12}: {1, -15}", "Money", Money.ToString() + " $");
            Console.ResetColor();
        }
Exemplo n.º 20
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (File.Exists(@".\Data\luck.txt") == false)
            {
                MessageBox.Show(@"没有找到奖项设置文件:.\Data\luck.txt");
                this.Close();
                return;
            }

            if (File.Exists(@".\Data\member.txt") == false)
            {
                MessageBox.Show(@"没有找到成员设置文件:.\Data\member.txt");
                this.Close();
                return;
            }

            //初始化奖项UI
            m_luck = new Luck(@".\Data\luck.txt");
            var luckList = m_luck.GetLuck();

            foreach (LuckSetting item in luckList)
            {
                Button button = new Button()
                {
                    Content = item.name, FontSize = 36, Margin = new Thickness(0, 10, 0, 0), DataContext = item
                };
                button.Click     += LuckButton_Click;
                button.Foreground = new SolidColorBrush(Color.FromArgb(210, 0, 0, 0));
                pageMainPage.stackPanelLuckList.Children.Add(button);
            }

            //初始化玩家数据
            m_memberManager = new MemberManager(@".\Data\member.txt");

            if (File.Exists(@".\Data\title.txt"))
            {
                pageMainPage.labelTitle.Content = File.ReadAllText(@".\Data\title.txt");
            }

            pageMainPage.labelTitle.FontSize = 24d / 240 * this.ActualHeight;


            ChangePage(PAGE_TYPE.PAGE_MAIN);
        }
Exemplo n.º 21
0
        private static void AddNewRoom(IMapGenerationParams mapParams, List <Room> rooms)
        {
            var newRoom = new Room()
            {
                TilePos = new Point(
                    x: Luck.Next(1, mapParams.Width - 1),  // external wall border required
                    y: Luck.Next(1, mapParams.Height - 1)  // external wall border required
                    ),
                Size = new Size(1, 1)
            };

            var isNotAdjacentToOtherRooms = rooms
                                            .All(room => !room.Intersects(newRoom, mapParams.MinRoomSeparation));

            if (isNotAdjacentToOtherRooms)
            {
                rooms.Add(newRoom);
            }
        }
Exemplo n.º 22
0
    public IEnumerator CreateEnemy()
    {
        TraitScr.ShouldSpin   = false;
        ElementScr.ShouldSpin = false;
        MonsterScr.ShouldSpin = false;
        IsCharacterTurn       = false;
        ps.IsCharacterTurn    = true;
        wait = false;
        pc   = ps.GetComponent <Character>();
        ec   = es.GetComponent <Character>();

        //new ids and stats
        ElementId = Random.Range(1, 6);
        TraitId   = Random.Range(6, 11);
        MonsterId = Random.Range(11, 16);
        Muck      = -1;
        Chips     = 100 + (ps.Lvl * 10);
        Atk       = 0;
        Def       = 0;
        Luck      = 0;
        Frozen    = false;
        setTrait(TraitId);
        setElement(ElementId);
        setMonster(MonsterId);
        float a = (float)Atk * (((float)ps.Lvl * 0.1f) + 0.2f);
        float d = (float)Def * (((float)ps.Lvl * 0.1f) + 0.2f);
        float l = (float)Luck * (((float)ps.Lvl * 0.1f) + 0.2f);

        Atk      = (int)a;
        Def      = (int)d;
        Luck     = (int)l;
        Stuntime = -1;


        AtkText.text   = "Atk X " + Atk.ToString();
        DefText.text   = "Def X " + Def.ToString();
        LuckText.text  = "Luck X " + Luck.ToString();
        ChipsText.text = "Chips X " + Chips.ToString();
        name           = NameText.text;

        //declare the monster
        Description.text        = "A " + name + " appears!";
        mm.b1.interactable      = true;
        mm.b2.interactable      = true;
        mm.b3.interactable      = true;
        mm.b4.interactable      = true;
        Description.text       += "\nIt is your turn!";
        mm.MoveBtn.interactable = true;

        if (mm.PlayerID == 1)
        {
            mm.b1.interactable = false;
        }
        if (mm.PlayerID == 2)
        {
            mm.b2.interactable = false;
        }
        if (mm.PlayerID == 3)
        {
            mm.b3.interactable = false;
        }
        if (mm.PlayerID == 4)
        {
            mm.b4.interactable = false;
        }

        //        yield return new WaitForSeconds(1f);
        TraitScr.SetImage(TraitId - 6);

//        yield return new WaitForSeconds(1f);
        ElementScr.SetImage(ElementId - 1);

//        yield return new WaitForSeconds(1f);
        MonsterScr.SetImage(MonsterId - 11);
        yield return(null);
    }
Exemplo n.º 23
0
        public override void Init(Game game)
        {
            var boardComp     = game.Entities.GetSingleComponent <BoardComp>();
            var tilePositions = boardComp
                                .TilePositionsByTileId
                                .Select(tileIdAndPosition => tileIdAndPosition.Value)
                                .ToList();

            var tilesPosWithSpaceAround = tilePositions
                                          .Where(tilePos => HasSpaceAround(tilePositions, tilePos))
                                          .ToList();

            var occupiedTiles = new List <Point>();

            var playerTile = tilesPosWithSpaceAround[Luck.Next(tilesPosWithSpaceAround.Count)];

            game.AddEntity(CreatePlayer(playerTile));
            occupiedTiles.Add(playerTile);

            var tilePosAndDistances = GetDistancesFrom(boardComp, playerTile)
                                      .Where(tile => tilePositions.Contains(tile.tilePos))
                                      .ToList();

            var enemiesCounter    = 0;
            var totalEnemiesCount = SpawnConfig.GetEnemyNumber(FloorFactor);
            var enemySpeedRange   = SpawnConfig.GetEnemySpeedRangeInGameTicks(FloorFactor);

            while (enemiesCounter < totalEnemiesCount)
            {
                var enemy = CreateEnemy(enemySpeedRange, boardComp, tilePosAndDistances, occupiedTiles);
                if (enemy == null)
                {
                    continue;
                }

                game.AddEntity(enemy);
                enemiesCounter++;
            }

            var maxDistance = tilePosAndDistances.Max(tcd => tcd.distance);

            // TODO avoid spawining 2 items in the same tile

            game.AddEntity(CreateFood(tilePosAndDistances, occupiedTiles, maxDistance));
            game.AddEntity(CreateTorch(tilePosAndDistances, occupiedTiles, maxDistance));
            game.AddEntity(CreateMapRevealer(tilePosAndDistances, occupiedTiles, maxDistance));

            var isLastFloor = FloorFactor == 1f;

            if (isLastFloor)
            {
                game.AddEntity(CreateAmulet(tilePosAndDistances, occupiedTiles, maxDistance));
            }
            else
            {
                var tilePosAndDistWithSpaceAround = tilePosAndDistances
                                                    .Where(tpad => tilesPosWithSpaceAround.Contains(tpad.tilePos))
                                                    .ToList();

                game.AddEntity(CreateDownStairs(tilePosAndDistWithSpaceAround, occupiedTiles, maxDistance));
            }

            var isFirstFloor = PreviousFloorResult == null;

            if (!isFirstFloor)
            {
                game.AddEntity(CreateUpStairs(playerTile));
            }

            game.RemoveSystem(this);
        }
Exemplo n.º 24
0
 public void SetSeed(int seed) => GameSeed = Luck.Reset(seed);
        public void TestConstructor()
        {
            Luck luck = new Luck();

            Assert.AreEqual("Luck Property:\tOwned by: Banker", luck.ToString());
        }
 public void SetLuckData(Luck luck)
 {
     m_luck = luck;
 }
Exemplo n.º 27
0
        public override string ToString()
        {
            string stats = Health.ToString() + "\n" + Strength.ToString() + "\n" + Dexterity.ToString() + "\n" + Agility.ToString() + "\n" + Inteligence.ToString() + "\n" + Luck.ToString() + "\n" + Statpoints.ToString() + "\n" + Level.ToString() + "\n" + ExperiencePoints.ToString();
            string hash  = GetSha1("Blin113" + stats);      //blin113 is just here to make sure you can't cheat without access to the code.

            stats += "\n" + hash;
            return(stats);
        }
Exemplo n.º 28
0
 private void ResetProps()
 {
     ButtonVisible    = false;
     CurrentLuck      = new Luck();
     CurrentAnimation = "happybox.json";
 }
Exemplo n.º 29
0
        public void TestConstructor()
        {
            Luck luck = new Luck();

            Assert.AreEqual("Luck", luck.ToString().Substring(0, 4));
        }
Exemplo n.º 30
0
Arquivo: NPC.cs Projeto: cvogt/AlbLib
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                if (unknown != null)
                {
                    hashCode += 1000000007 * unknown.GetHashCode();
                }
                hashCode += 1000000009 * Type.GetHashCode();
                hashCode += 1000000021 * Gender.GetHashCode();
                hashCode += 1000000033 * Race.GetHashCode();
                hashCode += 1000000087 * Class.GetHashCode();
                hashCode += 1000000093 * Magic.GetHashCode();
                hashCode += 1000000097 * Level.GetHashCode();
                hashCode += 1000000103 * Language.GetHashCode();
                hashCode += 1000000123 * Appearance.GetHashCode();
                hashCode += 1000000181 * Face.GetHashCode();
                hashCode += 1000000207 * InventoryPicture.GetHashCode();
                hashCode += 1000000223 * ActionPoints.GetHashCode();
                hashCode += 1000000241 * DialogueOptions.GetHashCode();
                hashCode += 1000000271 * ResponseOptions.GetHashCode();
                hashCode += 1000000289 * TrainingPoints.GetHashCode();
                hashCode += 1000000297 * Gold.GetHashCode();
                hashCode += 1000000321 * Rations.GetHashCode();
                hashCode += 1000000349 * Conditions.GetHashCode();
                hashCode += 1000000363 * Strength.GetHashCode();
                hashCode += 1000000403 * Intelligence.GetHashCode();
                hashCode += 1000000409 * Dexterity.GetHashCode();
                hashCode += 1000000411 * Speed.GetHashCode();
                hashCode += 1000000427 * Stamina.GetHashCode();
                hashCode += 1000000433 * Luck.GetHashCode();
                hashCode += 1000000439 * MagicResistance.GetHashCode();
                hashCode += 1000000447 * MagicTallent.GetHashCode();
                hashCode += 1000000453 * CloseRangeCombat.GetHashCode();
                hashCode += 1000000459 * LongRangeCombat.GetHashCode();
                hashCode += 1000000483 * CriticalHit.GetHashCode();
                hashCode += 1000000513 * Lockpicking.GetHashCode();
                hashCode += 1000000531 * LifePoints.GetHashCode();
                hashCode += 1000000579 * SpellPoints.GetHashCode();
                hashCode += 1000000007 * Age.GetHashCode();
                hashCode += 1000000009 * BaseProtection.GetHashCode();
                hashCode += 1000000021 * Protection.GetHashCode();
                hashCode += 1000000033 * BaseDamage.GetHashCode();
                hashCode += 1000000087 * Damage.GetHashCode();
                hashCode += 1000000093 * Experience.GetHashCode();
                if (Spells != null)
                {
                    hashCode += 1000000097 * Spells.GetHashCode();
                }
                if (Name != null)
                {
                    hashCode += 1000000103 * Name.GetHashCode();
                }
                if (SpellStrengths != null)
                {
                    hashCode += 1000000123 * SpellStrengths.GetHashCode();
                }
            }
            return(hashCode);
        }