Esempio n. 1
0
        public string MoveCategory(MoveCategory category)
        {
            var i      = (int)category;
            var backup = InnerBackup.MoveCategories;

            return(MoveCategories == null ? backup == null ? null : backup.ValueOrDefault(i) : MoveCategories.ValueOrDefault(i));
        }
Esempio n. 2
0
 private static void AttackedUpItem(DefContext def, MoveCategory cat, StatType stat)
 {
     if (def.AtkContext.Move.Move.Category == cat)
     {
         ITs.ChangeLv5D(def.Defender, stat, 1);
     }
 }
Esempio n. 3
0
 private Move(string name, Type type, MoveCategory category, int attackPower,
              Action <Pokémon, Pokémon> additionalEffects)
 {
     Name        = name;
     AttackType  = type;
     Category    = category;
     AttackPower = attackPower;
     AllMoves.Add(this);
 }
Esempio n. 4
0
 public MoveDictionary(string name, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int pp, int acc, int pri)
 {
     Name        = name;
     Type        = t;
     Speciality  = b;
     StatusValue = stat;
     Accuracy    = acc;
     Priority    = pri;
 }
        public void DetectCurrentMoveIsOverwrite()
        {
            //setup:
            GridUpdater.InsertIntoGrid(new Tuple <ushort, ushort>(1, 1), Moves.O);
            //act
            MoveCategory actualError = TurnValidator.CurrentMoveIsOverwrite(new Tuple <ushort, ushort>(1, 1));

            //assert
            actualError.Should().Be(MoveCategory.PositionAlreadyFilledError);
        }
Esempio n. 6
0
 internal MoveType(int id, BattleType type, MoveCategory category, int power, int accuracy, int pp, MoveRange range)
 {
     _id       = id;
     _type     = type;
     _category = category;
     _power    = power;
     _accuracy = accuracy;
     _pp       = pp;
     _range    = range;
 }
Esempio n. 7
0
 public MoveDictionary(string name, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, Action <bool> act, int pri)
 {
     Name        = name;
     PP          = pp;
     Type        = t;
     Speciality  = b;
     StatusValue = stat;
     Accuracy    = acc;
     uniqueActionSetSomeBattleEffect = act;
     Priority = pri;
 }
Esempio n. 8
0
        public async Task GetMoveCategoryResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            MoveCategory moveCategory = await client.GetResourceAsync <MoveCategory>(1);

            // assert
            Assert.True(moveCategory.Id != default(int));
        }
Esempio n. 9
0
 public MoveDictionary(string name, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, Func <MoveDictionary, bool> protection, int pri)
 {
     Name                 = name;
     PP                   = pp;
     Type                 = t;
     Speciality           = b;
     StatusValue          = stat;
     Accuracy             = acc;
     Protection           = protection;
     Priority             = pri;
     IncreasinglyUnlikely = true;
 }
Esempio n. 10
0
 /* The main Move constructor takes the name, power, accuracy, priority, type, maximum PP, and flags of the move.
  * All the parameters are set appropriately. Array.Copy() is used to copy the flags array. */
 public Move(string name, byte power, byte accuracy, sbyte priority, MoveCategory moveCategory, PkmnType moveType, byte maxPP, bool[] flags)
 {
     this.name     = name;
     this.power    = power;
     this.accuracy = accuracy;
     this.priority = priority;
     this.category = moveCategory;
     this.type     = moveType;
     pp            = new AttributePair(maxPP);
     this.flags    = new bool[20];
     Array.Copy(flags, this.flags, 20);
 }
Esempio n. 11
0
    //Constructors

    public MovedexEntry(DexID id, string moveName, string moveDescription, DexID genericAnimationID, PokemonType type, MoveCategory moveCategory, int basePP)
    {
        this.id              = id;
        this.moveName        = moveName;
        this.moveDescription = moveDescription;

        this.genericAnimationID = genericAnimationID;

        this.type         = type;
        this.moveCategory = moveCategory;

        this.basePP = basePP;
    }
        public void Test()
        {
            var speciesBuilder = new SpeciesBuilder(1, "Test Species");

            speciesBuilder.SetAllStats(10);
            speciesBuilder.Weight = 10;
            speciesBuilder.Height = 10;

            var type = new Type(
                "Test Type",
                "Test type description",
                new Dictionary <IType, decimal>(),
                new Dictionary <IType, decimal>());

            speciesBuilder.Types = new IndexedSet <IType> {
                type
            };

            var category = new MoveCategory("Test Category", PermanentStatType.Attack, PermanentStatType.Defense);
            var move     = new Move("Test Move", category, 10, 100, 1, 10, "Test Move Description", type);

            speciesBuilder.Moves = new IndexedSet <IMove> {
                move
            };
            speciesBuilder.Tier = new Tier("Test Tier", "Test Tier Description");

            var species = speciesBuilder.Build();
            var pokedex = new Pokedex(new HashSet <ISpecies> {
                species
            });
            var formats = new FormatRegistry(new UniqueDictionary <string, IFormat>
            {
                ["TestFormat"] = new Format("TestFormat", "Test Format")
            });
            var generation     = new Generation("Test Generation", "TG", pokedex, formats);
            var pokemonBuilder = new BattlePokemonBuilder(generation.StatFormula, "Test Pokemon", 10);

            var pokemon  = pokemonBuilder.WithSpecies(species).Build(species);
            var pokemons = new IndexedSet <IBattlePokemon> {
                pokemon
            };
            var trainers = new IndexedSet <ITrainer>
            {
                new Trainer("Test Trainer", pokemons)
            };
            var battle       = new Battle(generation, trainers);
            var burn         = new BurnStatus(pokemon, battle.EventBus);
            var normalAttack = battle.StatFormula.CalculateStat(pokemon.Attack);

            Assert.That(pokemon.Attack.ModifiedValue, Is.EqualTo(normalAttack / 2));
        }
Esempio n. 13
0
        public async Task Should_move_category_down_and_add_events()
        {
            var options = Shared.CreateContextOptions();

            var siteId = Guid.NewGuid();

            var category1 = new Category(siteId, "Category 1", 1, Guid.NewGuid());
            var category2 = new Category(siteId, "Category 2", 2, Guid.NewGuid());

            using (var dbContext = new AtlesDbContext(options))
            {
                dbContext.Categories.Add(category1);
                dbContext.Categories.Add(category2);
                await dbContext.SaveChangesAsync();
            }

            using (var dbContext = new AtlesDbContext(options))
            {
                var command = new MoveCategory
                {
                    Id        = category1.Id,
                    Direction = Direction.Down,
                    SiteId    = siteId
                };

                var cacheManager    = new Mock <ICacheManager>();
                var createValidator = new Mock <IValidator <CreateCategory> >();
                var updateValidator = new Mock <IValidator <UpdateCategory> >();

                var sut = new CategoryService(dbContext,
                                              cacheManager.Object,
                                              createValidator.Object,
                                              updateValidator.Object);

                await sut.MoveAsync(command);

                var updatedCategory1 = await dbContext.Categories.FirstOrDefaultAsync(x => x.Id == category1.Id);

                var updatedCategory2 = await dbContext.Categories.FirstOrDefaultAsync(x => x.Id == category2.Id);

                var event1 = await dbContext.Events.FirstOrDefaultAsync(x => x.TargetId == category1.Id);

                var event2 = await dbContext.Events.FirstOrDefaultAsync(x => x.TargetId == category2.Id);

                Assert.AreEqual(category2.SortOrder, updatedCategory1.SortOrder);
                Assert.AreEqual(category1.SortOrder, updatedCategory2.SortOrder);
                Assert.NotNull(event1);
                Assert.NotNull(event2);
            }
        }
Esempio n. 14
0
        private void style_addCritical_Click(object sender, EventArgs e)
        {
            if (CheckSelectedMove())
            {
                FaceLockMoves move     = (FaceLockMoves)nl_styleBox.SelectedItem;
                MoveCategory  category = ((MoveCategory)nl_Categories.SelectedItem);
                Skill         skill    = (Skill)nl_moveResult.SelectedItem;
                move = UpdateMove(move, skill, category, 3);

                //Update Style List
                Data_Classes.Style fightingStyle = ((FaceLockMoves)nl_styleBox.SelectedItem).StyleItem;
                UpdateStyleList(move, fightingStyle.Name);
            }
        }
Esempio n. 15
0
    public MoveData PartialClone(
        MoveCategory category,
        string moveType,
        float basePower, float accuracy, int priority
        )
    {
        MoveData clone = this.Clone();

        this.category  = category;
        this.moveType  = moveType;
        this.basePower = Mathf.FloorToInt(basePower);
        this.accuracy  = accuracy;
        this.priority  = priority;
        return(clone);
    }
Esempio n. 16
0
        private static void ReHurtBerry(DefContext def, MoveCategory category)
        {
            var aer = def.AtkContext.Attacker;

            if (def.AtkContext.Move.Move.Category == category && aer.CanEffectHurt)
            {
                int hp = aer.Pokemon.MaxHp >> 3;
                if (hp == 0)
                {
                    hp = 1;
                }
                aer.ShowLogPm("ReHurtItem", def.Defender.Id, def.Defender.Pokemon.Item);
                aer.Hp -= hp;
            }
        }
Esempio n. 17
0
 public MoveDictionary(string name, int d, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, int pri, string toFoe)
 {
     Name        = name;
     damage      = d;
     Type        = t;
     Speciality  = b;
     StatusValue = stat;
     Accuracy    = acc;
     PP          = pp;
     if (toFoe.Contains("all"))
     {
         AttackAll = true;
     }
     ToFoe    = Parser.parseToFoe(toFoe);
     Priority = pri;
 }
Esempio n. 18
0
 public MoveDictionary(string name, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, string toFoe, Func <Pokemon, string> act, int pri)
 {
     Name                   = name;
     PP                     = pp;
     Type                   = t;
     Speciality             = b;
     StatusValue            = stat;
     Accuracy               = acc;
     uniqueActionOnePokemon = act;
     if (toFoe.Contains("all"))
     {
         AttackAll = true;
     }
     ToFoe    = Parser.parseToFoe(toFoe);
     Priority = pri;
 }
Esempio n. 19
0
 public Move(String dataString)
 {
     string[] data = dataString.Split(',');
     id                     = Convert.ToInt32(data[0]);
     internalName           = data[1];
     dispalyName            = data[2];
     functionCode           = Int32.Parse(data[3]);
     baseDamage             = Convert.ToInt32(data[4]);
     type                   = data[5];
     moveCategory           = (MoveCategory)Enum.Parse(typeof(MoveCategory), data[6]);
     accuracy               = Convert.ToInt32(data[7]);
     totalPP                = Convert.ToInt32(data[8]);
     additionalEffectChance = Convert.ToInt32(data[9]);
     target                 = (Target)Enum.Parse(typeof(Target), data[10]);
     priority               = Convert.ToInt32(data[11]);
     moveProperties         = MovePropertiesFromString(data[12]);
     description            = data[13];
 }
Esempio n. 20
0
        public async Task <ActionResult> MoveDown([FromBody] Guid id)
        {
            var site = await _contextService.CurrentSiteAsync();

            var user = await _contextService.CurrentUserAsync();

            var command = new MoveCategory
            {
                Id        = id,
                SiteId    = site.Id,
                UserId    = user.Id,
                Direction = Direction.Down
            };

            await _categoryService.MoveAsync(command);

            return(Ok());
        }
Esempio n. 21
0
 private void wrestler_addCritical_Click(object sender, EventArgs e)
 {
     if (CheckSelectedMove())
     {
         if (nl_wresterList.SelectedIndex < 0)
         {
             return;
         }
         FaceLockMoves move     = (FaceLockMoves)nl_wresterList.SelectedItem;
         int           index    = wrestlerMoves.IndexOf(move);
         MoveCategory  category = ((MoveCategory)nl_Categories.SelectedItem);
         Skill         skill    = (Skill)nl_moveResult.SelectedItem;
         move = UpdateMove(move, skill, category, 3);
         nl_wresterList.SelectedItem = move;
         wrestlerMoves[index]        = move;
         nl_wresterList_SelectedIndexChanged(null, null);
     }
 }
Esempio n. 22
0
 public MoveDictionary(string name, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, StatusType status, string statusToFoe, List <Pokemon.Stat> statsToChange, int statVal, string statToFoe, int pri)
 {
     Name        = name;
     PP          = pp;
     Type        = t;
     Speciality  = b;
     StatusValue = stat;
     Accuracy    = acc;
     Status      = status;
     if (statusToFoe.Contains("all"))
     {
         AttackAll = true;
     }
     ToFoe          = Parser.parseToFoe(statusToFoe);
     StatsToChange  = statsToChange;
     statAmount     = statVal;
     this.statToFoe = Parser.parseToFoe(statToFoe);
     Priority       = pri;
 }
Esempio n. 23
0
        private FaceLockMoves UpdateMove(FaceLockMoves move, Skill skill, MoveCategory category, int damageLevel)
        {
            //Ensure the correct category is selected
            for (int i = 0; i < nl_Categories.Items.Count; i++)
            {
                foreach (Skill catSkill in ((MoveCategory)nl_Categories.Items[i]).Skills)
                {
                    if (skill.Equals(catSkill))
                    {
                        category = (MoveCategory)nl_Categories.Items[i];
                        break;
                    }
                }
            }

            try
            {
                if (category.Name.Equals("Basic Moves"))
                {
                    move.BasicSkills[damageLevel] = skill;

                    if (skill.SkillName.Contains("Irish Whip"))
                    {
                        move.Type[damageLevel] = SkillType.IrishWhip;
                    }
                    else
                    {
                        move.Type[damageLevel] = SkillType.BasicMove;
                    }
                }
                else
                {
                    move.Type[damageLevel]         = SkillType.CustomMove;
                    move.CustomSkills[damageLevel] = skill;
                }
            }
            catch (Exception ex)
            {
                L.D("UpdateMove Error: " + ex.Message);
            }

            return(move);
        }
Esempio n. 24
0
        public MoveDictionary(string name, int damage, int statValue, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory category, int acc, List <Pokemon.Stat> statsToChange, string atkToFoe, string statToFoe, int statLikeliness, int pri)
        {
            Name        = name;
            this.damage = damage;
            Type        = t;
            Speciality  = b;
            StatusValue = category;
            Accuracy    = acc;
            PP          = pp;

            statAmount    = statValue;
            StatsToChange = statsToChange;
            if (atkToFoe.Contains("all"))
            {
                AttackAll = true;
            }
            ToFoe          = Parser.parseToFoe(atkToFoe);
            StatLikeliness = statLikeliness;
            this.statToFoe = Parser.parseToFoe(statToFoe);
            Priority       = pri;
        }
Esempio n. 25
0
        private void style_addLight_Click(object sender, EventArgs e)
        {
            if (CheckSelectedMove())
            {
                try
                {
                    FaceLockMoves move     = (FaceLockMoves)nl_styleBox.SelectedItem;
                    MoveCategory  category = ((MoveCategory)nl_Categories.SelectedItem);
                    Skill         skill    = (Skill)nl_moveResult.SelectedItem;
                    move = UpdateMove(move, skill, category, 0);

                    //Update Style List
                    Data_Classes.Style fightingStyle = ((FaceLockMoves)nl_styleBox.SelectedItem).StyleItem;
                    UpdateStyleList(move, fightingStyle.Name);
                }
                catch (Exception exception)
                {
                    L.D("AddLightStyle Error:" + exception.Message);
                }
            }
        }
Esempio n. 26
0
        private void nl_Categories_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (nl_Categories.SelectedIndex < 0)
                {
                    return;
                }
                MoveCategory category = (MoveCategory)nl_Categories.SelectedItem;
                nl_moveResult.Items.Clear();

                foreach (Skill skill in category.Skills)
                {
                    nl_moveResult.Items.Add(skill);
                }

                nl_moveResult.SelectedIndex = 0;
            }
            catch (Exception exception)
            {
                L.D("CategoryDisplay Error: " + exception.Message);
            }
        }
Esempio n. 27
0
 public Move(String dataString)
 {
     string[] data = dataString.Split(',');
     id = Convert.ToInt32(data[0]);
     internalName = data[1];
     dispalyName = data[2];
     functionCode = Int32.Parse(data[3]);
     baseDamage = Convert.ToInt32(data[4]);
     type = data[5];
     moveCategory = (MoveCategory)Enum.Parse(typeof(MoveCategory), data[6]);
     accuracy = Convert.ToInt32(data[7]);
     totalPP = Convert.ToInt32(data[8]);
     additionalEffectChance = Convert.ToInt32(data[9]);
     target = (Target)Enum.Parse(typeof(Target), data[10]);
     priority = Convert.ToInt32(data[11]);
     moveProperties = MovePropertiesFromString(data[12]);
     description = data[13];
 }
Esempio n. 28
0
        protected override void Create(JsonData source)
        {
            description = source["description"].ToString();
            power = (int)source["power"];
            pp = (int)source["pp"];
            accuracy = Convert.ToDouble(source["accuracy"].ToString(), CultureInfo.InvariantCulture) / 100d;
            MoveCategory cat = 0;
            Enum.TryParse<MoveCategory>(source["category"].ToString(), true, out cat);
            category = cat;

            if (ShouldCacheData && !CachedMoves.ContainsKey(id))
                CachedMoves.Add(id, this);
        }
Esempio n. 29
0
 public MoveDictionary(string name, int d, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, List <Pokemon.Stat> statToChange, string toFoe, int pri) : this(name, d, pp, t, b, stat, acc, pri, toFoe)
 {
     StatsToChange = statToChange;
     if (toFoe.Contains("all"))
     {
         AttackAll = true;
     }
     ToFoe          = Parser.parseToFoe(toFoe);
     statToFoe      = Parser.parseToFoe(toFoe);
     statAmount     = d;
     StatLikeliness = 100;
 }
Esempio n. 30
0
 public MoveDictionary(string name, int d, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, string toFoe, int drainAmount, int pri) : this(name, d, pp, t, b, stat, acc, pri, toFoe)
 {
     this.DrainAmount = drainAmount;
 }
Esempio n. 31
0
 public MoveDictionary(string name, int d, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, StatusType status, string toFoe, int likeliness, int pri) : this(name, d, pp, t, b, stat, acc, pri, toFoe)
 {
     this.Status          = status;
     this.StatusLikliness = likeliness;
 }
Esempio n. 32
0
 public MoveDictionary(string name, int pp, Pokemon.PokeType t, MoveStore.Speciality b, MoveCategory stat, int acc, StatusType status, string toFoe, int pri) : this(name, pp, 0, t, b, stat, acc, pri, toFoe)
 {
     this.Status = status;
     if (toFoe.Contains("all"))
     {
         AttackAll = true;
     }
     ToFoe           = Parser.parseToFoe(toFoe);
     StatusLikliness = 100;
 }