Example #1
0
        public Race()
        {
            Name        = "";
            Key         = "";
            Description = "empty";

            StartingAttributes = new List <GameValue>();
            SkillProficiencies = new List <SkillProficiency>();
            Resistances        = new List <ResistanceData>();

            Traits = new List <AbilityUnlock>();
            Powers = new List <AbilityUnlock>();
            Spells = new List <AbilityUnlock>();

            ExpModifier = 1.0f;
            BaseSpeed   = 10;

            Upkeep         = new UpkeepData();
            StartingWealth = new GameValue();
            scale          = Vector3.one;

            maleDefaultHair    = "";
            maleDefaultBeard   = "";
            femaleDefaultHair  = "";
            femaleDefaultBeard = "";
        }
Example #2
0
        public override void CalculateStartSkills()
        {
            for (int j = 0; j < Database.GetProfession(professionKey).SkillProficiencies.Count; j++)
            {
                int value  = Database.GetProfession(professionKey).SkillProficiencies[j].Value;
                int result = GameValue.Roll(new GameValue(1, 2), false) * value;
                int index  = Database.Skills[(int)Database.GetProfession(professionKey).SkillProficiencies[j].Skill].Index;

                Attribute skill = new Attribute(index, AttributeType.Skill, result, 0, 100);

                attributes.SetSkill(skill);
            }

            for (int i = 0; i < Database.GetRace(raceKey).SkillProficiencies.Count; i++)
            {
                int value = Database.GetRace(raceKey).SkillProficiencies[i].Value;
                int index = Database.Skills[(int)Database.GetProfession(professionKey).SkillProficiencies[i].Skill].Index;

                Attribute skill = new Attribute(index, AttributeType.Skill, value, 0, 100);

                attributes.SetSkill(skill);
            }

            CalculateExpCosts();
        }
Example #3
0
        void UpdateShooting()
        {
            if (GameManager.isPaused)
            {
                return;
            }

            if (ActionsInterface.GetActionDown(shootAction))
            {
                if (hitActor != null)
                {
                    hitActor.AddModifiers(damageModifiers, "Shoot", true, GameManager.playerActor.gameObject, hitActor.gameObject);

                    GameValue npcHealth = hitActor.GetGameValueObject(healthBarGameValueName);
                    if (npcHealth.GetValueComponent(GameValue.GameValueComponent.BaseValue) <= 0)
                    {
                        npcHealth.ReInitialize();
                        GameManager.playerActor.AddModifiers(onKillModifiers, "On Kill", true, hitActor.gameObject, GameManager.playerActor.gameObject);
                    }
                }

                clip--;
                if (clip <= 0)
                {
                    clip  = maxClip;
                    ammo -= maxClip;
                    ammoHud.allTexts[1].SetText("| " + ammo.ToString());
                }
                ammoHud.allTexts[0].SetText(clip.ToString() + " ");
            }
        }
Example #4
0
        public void PlayRandomGame(GameValue aValue, GameValue cValue, bool aWin)
        {
            var gameService = new GameServiceImpl(seed);
            var a           = new User("a", "b")
            {
                Id = 1
            };
            var c = new User("c", "b")
            {
                Id = 2
            };
            var comp1 = gameService.JoinGame(a, GameType.RandomCompetitor);
            var comp2 = gameService.JoinGame(c, GameType.RandomCompetitor);

            Assert.AreEqual(null, comp1);
            Assert.AreEqual(a, comp2);

            var intermediateResult = gameService.Play(a, aValue);

            Assert.AreEqual(GameResult.NotCompleted, intermediateResult.Result);
            Assert.AreEqual(null, intermediateResult.Winner);
            Assert.AreEqual(null, intermediateResult.Looser);

            var result = gameService.Play(c, cValue);

            Assert.AreEqual(GameResult.HasWinner, result.Result);
            Assert.AreEqual(aWin ? a : c, result.Winner);
            Assert.AreEqual(aWin ? c : a, result.Looser);
        }
Example #5
0
        public Profession(string name, string key, string description, int hire_cost, UpkeepData upkeep, GameValue wealth)
        {
            Name        = name;
            Key         = key;
            Description = description;

            HealthPerLevel  = new GameValue();
            StaminaPerLevel = new GameValue();
            EssencePerLevel = new GameValue();

            MinimumAttributes = new List <int>();

            int index = 0;

            for (int i = 0; i < (int)BaseAttribute.Number; i++)
            {
                MinimumAttributes.Add(0);
                index++;
            }

            AttributePriorities = new List <BaseAttribute>();

            SkillProficiencies = new List <SkillProficiency>();

            StartingItems = new List <ItemShort>();

            Traits = new List <AbilityUnlock>();
            Powers = new List <AbilityUnlock>();
            Spells = new List <AbilityUnlock>();

            BaseHireCost   = hire_cost;
            Upkeep         = new UpkeepData(upkeep);
            StartingWealth = new GameValue(wealth);
        }
Example #6
0
 public void Test_Ocp2()
 {
     var testParams = new GameDefParams(this, "ocp2.gamedef.xml",
                                        new string[] { "eq-OneCardPoker2-0-s.xml", "eq-OneCardPoker2-1-s.xml" },
                                        new double[] { -0.0394736842106944, 0.0394736842106944 },
                                        0.0000000000005);
     GameValue gv = Solve(testParams, false, s => { s.PrepareVis = false; });
 }
Example #7
0
 public void Test_Ocp()
 {
     var testParams = new GameDefParams(this, "ocp.gamedef.xml",
                                        new string[] { "eq-OneCardPoker-0-s.xml", "eq-OneCardPoker-1-s.xml" },
                                        new double[] { -0.0641025641026934, 0.0641025641026934 },
                                        0.0000000000005);
     GameValue gv = Solve(testParams, false, s => { s.PrepareVis = false; });
 }
Example #8
0
 public void Test_Kuhn2()
 {
     var testParams = new GameDefParams(this, "kuhn2.gamedef.xml",
                                        new string[] { "eq-KunhPoker2-0-s.xml", "eq-KunhPoker2-1-s.xml" },
                                        new double[] { -1.0 / 18, 1.0 / 18 },
                                        0.00000000000000001);
     GameValue gv = Solve(testParams, false, null);
 }
Example #9
0
 public void Test_MiniFl()
 {
     var testParams = new GameDefParams(this, "mini-fl.gamedef.xml",
                                        new string[] { "eq-MiniFl-0-s.xml", "eq-MiniFl-1-s.xml" },
                                        new double[] { 0.0277777777778998, -0.0277777777778998 },
                                        0.0000000000005);
     GameValue gv = Solve(testParams, true, s => { s.PrepareVis = true; });
 }
Example #10
0
 public void Test_LeducHeRb()
 {
     var testParams = new GameDefParams(this, "leduc-he-rb.gamedef.xml",
                                        new string[] { "eq-LeducHeRb-0-s.xml", "eq-LeducHeRb-1-s.xml" },
                                        new double[] { -0.00464121889644268, 0.00464121889644268 },
                                        0.000000000005);
     GameValue gv = Solve(testParams, false, s => { s.PrepareVis = false; });
 }
Example #11
0
 public AlterCharacteristicEffect()
 {
     EffectType         = AbilityEffectType.Alter_Characteristic;
     CharacteristicType = AttributeType.None;
     Characteristic     = 0;
     Amount             = new GameValue();
     Duration           = new GameValue();
 }
Example #12
0
 public void Test_LeducHe()
 {
     var testParams = new GameDefParams(this, "leduc-he.gamedef.xml",
                                        new string[] { "eq-LeducHe-0-s.xml", "eq-LeducHe-1-s.xml" },
                                        new double[] { -0.0428032120390257, 0.0428032120390257 },
                                        0.000000000005);
     GameValue gv = Solve(testParams, false, s => { s.PrepareVis = false; });
 }
Example #13
0
 private void SetMemoryForAllSymmetry(GameValue gameValue, List <string> stringList)
 {
     foreach (string s in stringList)
     {
         Memory[s] = gameValue;
     }
     Console.WriteLine(Memory.Count);
 }
Example #14
0
 public WeaponAttackEffect()
 {
     EffectType = AbilityEffectType.Weapon_Attack;
     AttackMod  = 0;
     DamageType = DamageType.None;
     ProcChance = 0;
     Damage     = new GameValue();
 }
Example #15
0
 public WeaponAttackEffect(int attack_mod, DamageType damage_type, int proc, GameValue damage)
 {
     EffectType = AbilityEffectType.Weapon_Attack;
     AttackMod  = attack_mod;
     DamageType = damage_type;
     ProcChance = proc;
     Damage     = new GameValue(damage);
 }
Example #16
0
        public static SkillProficiency Randomize(GameValue value)
        {
            SkillProficiency sp = new SkillProficiency();

            sp.Skill   = (Skill)Random.Range(0, (int)Skill.Number);
            sp.Value   = value.Roll(false);
            sp.Minimum = 0;
            return(sp);
        }
Example #17
0
 public RestoreEffect()
 {
     EffectType    = AbilityEffectType.Restore;
     RestoreType   = RestoreType.None;
     Amount        = new GameValue();
     Duration      = new GameValue();
     LevelModifier = 0;
     OverCharge    = false;
 }
Example #18
0
        public void AccessExpressionTest( )
        {
            GameRule emptyRule = GameRule.GenerateEmpty( );

            Game.PeapareNew( );
            Game.Current.GameRule = emptyRule;
            EmptyBlock block = new EmptyBlock(new MapPosition(1, 1));
            GameValue  c     = block.Flammability;
        }
Example #19
0
        public void PlayResultTest(GameValue value1, GameValue value2, int winnerId)
        {
            user1.Value = value1;
            user2.Value = value2;
            var game   = new Game(user1, user2);
            var result = game.Play();

            Assert.AreEqual(winnerId, result.Winner.Id);
        }
Example #20
0
 public RestoreEffect(RestoreType type, GameValue amount, GameValue duration, bool overcharge, int level = 0)
 {
     EffectType    = AbilityEffectType.Restore;
     RestoreType   = type;
     Amount        = new GameValue(amount);
     Duration      = new GameValue(duration);
     LevelModifier = level;
     OverCharge    = overcharge;
 }
Example #21
0
        public void Test_MicorFl()
        {
            var testParams = new GameDefParams(this, "micro-fl.gamedef.xml",
                                               new string[] { "eq-MicroFl-0-s.xml", "eq-MicroFl-1-s.xml" },
                                               new double[] { -1.0 / 18, 1.0 / 18 },
                                               0.0000000000005);

            GameValue gv = Solve(testParams, false, s => { s.PrepareVis = false; });
        }
    public override void UpdateStateDisplay(TTTGameState gameState)
    {
        for (int i = 0; i < Game.XSize; i++)
        {
            for (int j = 0; j < Game.YSize; j++)
            {
                for (int k = 0; k < Game.ZSize; k++)
                {
                    var idx = k + j * Game.ZSize + i * Game.YSize * Game.ZSize;
                    switch (gameState.Board[i][j][k])
                    {
                    case Piece.e:
                        cubes[idx].GetComponent <MeshRenderer>().enabled   = false;
                        spheres[idx].GetComponent <MeshRenderer>().enabled = false;
                        var m = indicators[idx].GetComponent <MeshRenderer>();
                        m.enabled = true;
                        // When the nextPiece is palyed here, what value for the nextPiece player' nextPiece playrt is;
                        GameValue value = Solver.GetStatusValue(Game.DoMoveOnState(gameState, new TTTGameMove(i, j, k, gameState.NextPiece)));
                        switch (value)
                        {
                        case GameValue.Win:
                            // value is for next's next, metarial is showing next's expectation
                            m.material = loseMaterial;
                            break;

                        case GameValue.Lose:
                            // value is for next's next, metarial is showing next's expectation
                            m.material = winMaterial;
                            break;

                        case GameValue.Tie:
                            m.material = tieMaterial;
                            break;

                        case GameValue.Undecided:
                            m.material = undecidedMaterial;
                            break;
                        }
                        break;

                    case Piece.x:
                        cubes[idx].GetComponent <MeshRenderer>().enabled      = true;
                        spheres[idx].GetComponent <MeshRenderer>().enabled    = false;
                        indicators[idx].GetComponent <MeshRenderer>().enabled = false;
                        break;

                    case Piece.o:
                        cubes[idx].GetComponent <MeshRenderer>().enabled      = false;
                        spheres[idx].GetComponent <MeshRenderer>().enabled    = true;
                        indicators[idx].GetComponent <MeshRenderer>().enabled = false;
                        break;
                    }
                }
            }
        }
    }
Example #23
0
 public void Test_Kuhn_CA()
 {
     ChanceAbstractedGameDefParams testParams = new ChanceAbstractedGameDefParams(this, "Kuhn-CA", "kuhn.gamedef.xml",
                                                                                  new IChanceAbstraction [] { new KuhnChanceAbstraction(), new KuhnChanceAbstraction() },
                                                                                  new string[] { "eq-KunhPoker-0-s.xml", "eq-KunhPoker-1-s.xml" },
                                                                                  new double[] { -1.0 / 18, 1.0 / 18 },
                                                                                  0);
     // Set PrepareVis to true on purpose, to let it run too.
     GameValue gv = Solve(testParams, false, s => { s.PrepareVis = true; });
 }
Example #24
0
 public void Test_Kuhn()
 {
     var testParams = new GameDefParams(this, "kuhn.gamedef.xml",
                                        new string[] { "eq-KunhPoker-0-s.xml", "eq-KunhPoker-1-s.xml" },
                                        new double[] { -1.0 / 18, 1.0 / 18 },
                                        0);
     // Set PrepareVis to true on purpose, to let it run too.
     GameValue gv = Solve(testParams, false, s => { s.PrepareVis = true; });
     //GameValue.Vis.Show(gv, 0, Path.Combine(_outDir, "KuhnPoker-values-0.gv"));
 }
Example #25
0
        public EmptyBlock([NotNull] XElement resource) : base(resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }

            ForestCoverRate =
                ReadUnnecessaryValue(resource, nameof(ForestCoverRate), GameRandom.Current.RandomGameValue( ));
        }
Example #26
0
        public void GameValue()
        {
            GameValue gv;

            gv = new GameValue(0);
            gv = new GameValue(1);
            gv = new GameValue(2);
            gv = new GameValue(-1);
            gv = new GameValue(-2);
        }
Example #27
0
        public decimal getBigBlindAmount()
        {
            decimal amt = 0;

            if ((GameValue != null) && (GameValue != ""))
            {
                amt = Convert.ToDecimal(GameValue.Split('-')[1]);
            }
            return(amt);
        }
Example #28
0
        internal void AddIntValue(string name, int min, int max)
        {
            Property  prop  = new Property(name);
            GameValue value = new GameValue();

            value.dataType = GameConsts.DATA_TYPE.INT;
            value.minValue = min;
            value.maxValue = max;
            prop.value     = value;
            values.Add(prop);
        }
Example #29
0
 public GameValue GetGameState(GameObjectId id, string key)
 {
     if (GameClientObject != null)
     {
         GameValue gameValue = default(GameValue);
         object[]  array     = new object[] { id, key, gameValue };
         object    success   = DeObfuscator.GetStateMethod.Invoke(GameClientObject, array);
         return((GameValue)array[2]);
     }
     return(default(GameValue));
 }
Example #30
0
        public void SetGameValue(GameValue gameValue)
        {
            initialized = false;
            if (this.gameValue != null)
            {
                this.gameValue.RemoveChangeListener(UpdateUIObject);
            }

            this.gameValue = gameValue;
            InitializeWithGameValue();
        }
Example #31
0
    public static int GetGameValue(GameValue value)
    {
        switch (value)
        {
            case GameValue.Time:
                return Mathf.FloorToInt(TotalTime);

            case GameValue.Star:
                return TotalGetStar;

            case GameValue.Score:
                return TotalScore;

            case GameValue.HighScore:
                return HighScore;
        }
        return 0;
    }