public void SetModel(ScenarioId scenario, int id, ScenarioPokemon model)
 {
     _model    = model;
     _scenario = scenario;
     _id       = id;
     RaiseAllPropertiesChanged();
 }
    public ScenarioPokemonViewModel(
        IJumpService jumpService,
        IScenarioWarriorService scenarioWarriorService,
        IIdToNameService idToNameService)
    {
        _model = new ScenarioPokemon();;

        JumpToPokemonCommand      = new RelayCommand <int>(id => jumpService.JumpTo(PokemonSelectorEditorModule.Id, id));
        JumpToAbilityCommand      = new RelayCommand <int>(id => jumpService.JumpTo(AbilitySelectorEditorModule.Id, id));
        JumpToFirstWarriorCommand = new RelayCommand(() =>
        {
            int i = 0;
            foreach (var sw in scenarioWarriorService.Retrieve((int)_scenario).Enumerate())
            {
                if (!sw.ScenarioPokemonIsDefault(0) && sw.GetScenarioPokemon(0) == _id)
                {
                    jumpService.JumpToNested(ScenarioWarriorSelectorEditorModule.Id, (int)_scenario, i);
                    return;
                }
                i++;
            }
        });

        PokemonItems = idToNameService.GetComboBoxItemsExceptDefault <IPokemonService>();
        PokemonItems.Add(new SelectorComboBoxItem(511, "Default"));
        AbilityItems = idToNameService.GetComboBoxItemsPlusDefault <IAbilityService>();
    }
예제 #3
0
    public void AccessorsSetCorrectValues()
    {
        ScenarioPokemon a = new ScenarioPokemon
        {
            Pokemon = PokemonId.Jigglypuff,
            Ability = AbilityId.Lullaby,
            HpIv    = 15,
            AtkIv   = 15,
            DefIv   = 15,
            SpeIv   = 15,
            Exp     = 1020
        };

        var expected = new byte[]
        {
            0x14, 0x00, 0xFC, 0x03, 0xEF, 0xBD, 0x97, 0x04
        };

        a.Pokemon.Should().Be(PokemonId.Jigglypuff);
        a.Ability.Should().Be(AbilityId.Lullaby);
        a.HpIv.Should().Be(15);
        a.AtkIv.Should().Be(15);
        a.DefIv.Should().Be(15);
        a.SpeIv.Should().Be(15);
        a.Exp.Should().Be(1020);

        a.Data.Should().Equal(expected);
    }
예제 #4
0
 public static void Render(this IConsole console, ScenarioPokemon scenarioPokemon, ScenarioId scenarioId, int scenarioPokemonId)
 {
     console.WriteTitle($"Scenario = {scenarioId}, Entry = {scenarioPokemonId}");
     console.WriteProperty("Pokemon", scenarioPokemon.Pokemon.ToString());
     console.WriteProperty("Ability", scenarioPokemon.Ability.ToString());
     console.WriteProperty("IVs", $"Hp {scenarioPokemon.HpIv} / Atk {scenarioPokemon.AtkIv} / Def {scenarioPokemon.DefIv} / Spe {scenarioPokemon.SpeIv}");
     console.WriteProperty("Init Exp", $"{scenarioPokemon.Exp} (Approx. Link = {Math.Round(Core.Services.LinkCalculator.CalculateLink(scenarioPokemon.Exp))}%)");
 }
예제 #5
0
    public void AccessorsReturnCorrectValues()
    {
        ScenarioPokemon a = new ScenarioPokemon(new byte[]
        {
            0x14, 0x00, 0xFC, 0x03, 0xEF, 0xBD, 0x97, 0x04
        });

        a.Pokemon.Should().Be(PokemonId.Jigglypuff);
        a.Ability.Should().Be(AbilityId.Lullaby);
        a.HpIv.Should().Be(15);
        a.AtkIv.Should().Be(15);
        a.DefIv.Should().Be(15);
        a.SpeIv.Should().Be(15);
        a.Exp.Should().Be(1020);
    }
예제 #6
0
    private void ValidateTutorialMatchup(ScenarioPokemon attackingScenarioPokemon, ScenarioPokemon targetScenarioPokemon, bool oichisPokemon = false)
    {
        Pokemon attackingPokemon = _pokemonService.Retrieve((int)attackingScenarioPokemon.Pokemon);
        Pokemon targetPokemon    = _pokemonService.Retrieve((int)targetScenarioPokemon.Pokemon);
        Move    move             = _moveService.Retrieve((int)attackingPokemon.Move);

        // moves always hit during the tutorial, so  this isn't necessary
        //if (move.Accuracy != 100)
        //{
        //    ReportProbable($"The move {attackingPokemon.Move} used by {attackingScenarioPokemon.Pokemon} does not have 100% accuracy (it has {move.Accuracy}%). If it misses it will softlock the tutorial.");
        //}
        if (move.Power < 30)
        {
            ReportProbable($"The move used by {attackingScenarioPokemon.Pokemon} is weak ({move.Power}), thus there's a risk it doesn't one shot the opponent in the tutorial");
        }
        if (move.Power < 60 && targetPokemon.Resists(move.Type))
        {
            ReportProbable($"The defending pokemon {targetScenarioPokemon.Pokemon} resists move {attackingPokemon.Move} used by {attackingScenarioPokemon.Pokemon}, thus there's a risk it doesn't one shot the opponent in the tutorial");
        }
        if (!_moveRangeService.Retrieve((int)move.Range).GetInRange(1))
        {
            ReportGuaranteed($"The move {attackingPokemon.Move} used by pokemon {attackingScenarioPokemon.Pokemon} has range {move.Range} which does not hit the square immediately ahead of the user. This causes a tutorial softlock.");
        }
        if (oichisPokemon && _moveRangeService.Retrieve((int)move.Range).GetInRange(24))
        {
            ReportProbable($"The move {attackingPokemon.Move} used by pokemon {attackingScenarioPokemon.Pokemon} has range {move.Range} thus may take out Koroku, skipping the player's turn. This causes the 'Back' button to be not work in battles.");
        }
        if (invalidEffects.Contains(move.Effect1))
        {
            ReportGuaranteed($"The move {attackingPokemon.Move} used by pokemon {attackingScenarioPokemon.Pokemon} has effect {move.Effect1} which is multi-turn. This causes a tutorial softlock.");
        }
        if (invalidEffects.Contains(move.Effect2))
        {
            ReportGuaranteed($"The move {attackingPokemon.Move} used by pokemon {attackingScenarioPokemon.Pokemon} has effect {move.Effect2} which is multi-turn. This causes a tutorial softlock.");
        }
        if (targetPokemon.IsImmuneTo(move.Type))
        {
            ReportGuaranteed($"The defending pokemon {targetScenarioPokemon.Pokemon} is immune to move {attackingPokemon.Move} used by {attackingScenarioPokemon.Pokemon}.");
        }
        if (targetScenarioPokemon.Ability == AbilityId.Sturdy)
        {
            ReportGuaranteed($"The defending pokemon {targetScenarioPokemon.Pokemon} has the ability Sturdy, which means it can not be one shot in the tutorial");
        }
        if (!MoldBreakerAbilitys.Contains(attackingScenarioPokemon.Ability))
        {
            void reportAbilityTypeImmunity(AbilityId abilityId, TypeId type) => ReportGuaranteed($"The defending pokemon {targetScenarioPokemon.Pokemon} has the ability {abilityId}, which means it is immune to the {type} type move {attackingPokemon.Move} used by {attackingScenarioPokemon.Pokemon}");

            switch (targetScenarioPokemon.Ability)
            {
            case AbilityId.Levitate:
                if (move.Type == TypeId.Ground)
                {
                    reportAbilityTypeImmunity(AbilityId.Levitate, TypeId.Ground);
                }
                break;

            case AbilityId.WaterAbsorb:
                if (move.Type == TypeId.Water)
                {
                    reportAbilityTypeImmunity(AbilityId.WaterAbsorb, TypeId.Water);
                }
                break;

            case AbilityId.FlashFire:
                if (move.Type == TypeId.Fire)
                {
                    reportAbilityTypeImmunity(AbilityId.FlashFire, TypeId.Fire);
                }
                break;

            case AbilityId.VoltAbsorb:
                if (move.Type == TypeId.Electric)
                {
                    reportAbilityTypeImmunity(AbilityId.VoltAbsorb, TypeId.Electric);
                }
                break;

            case AbilityId.Lightningrod:
                if (move.Type == TypeId.Electric)
                {
                    reportAbilityTypeImmunity(AbilityId.Lightningrod, TypeId.Electric);
                }
                break;

            case AbilityId.MotorDrive:
                if (move.Type == TypeId.Electric)
                {
                    reportAbilityTypeImmunity(AbilityId.MotorDrive, TypeId.Electric);
                }
                break;
            }
        }
    }