Пример #1
0
    // public static List<YokaiAction> YokaiActionList = new List<YokaiAction>() {
    //     YokaiAction.Attack, YokaiAction.Remove, YokaiAction.Remove, YokaiAction.AttackOrRemove, YokaiAction.Remove, YokaiAction.Attack, YokaiAction.Remove,
    // };

    public static string Description(this YokaiAction action)
    {
        if (action.IsBlocked)
        {
            return("The Yokai is staggered !\nThis action is rendered unusable for one turn");
        }
        else
        {
            return(action.Type
                   switch {
                YokaiActionType.Attack => "Attack\n\nThe Yokai will attack this location and remove 1 health.\nYou can defend yourself by placing a Seal of any type",
                YokaiActionType.AttackAndRemove => "Attack and Remove\n\nThe Yokai will attack\nAfterwards, the Yokai will remove the seal in this location",
                YokaiActionType.Remove => "Remove\n\nThe Yokai will remove the seal in this location. Try not to place any seal here",
                YokaiActionType.ElementalAttack => $"{action.Element} attack\n\nThe Yokai will attack this location with {action.Element}.\n{action.Element.Destroys()} will not offer any protection, but {action.Element.BlockedBy()} will stagger the Yokai.\nAny other element will be removed",
                _ => "ERROR"
            });
Пример #2
0
    public void ShowArrow(YokaiAction action)
    {
        Spatial S = new Spatial();
        var     a = S.Transform.basis.x;

        Intent   = action;
        Modulate = yellowishModulate;
        switch (action.Type)
        {
        case YokaiActionType.Attack:
            (Sprite.Texture as AtlasTexture).Region = new Rect2(new Vector2(0, 0), new Vector2(120, 120));
            break;

        case YokaiActionType.AttackAndRemove:
            (Sprite.Texture as AtlasTexture).Region = new Rect2(new Vector2(240, 0), new Vector2(120, 120));
            break;

        case YokaiActionType.Remove:
            (Sprite.Texture as AtlasTexture).Region = new Rect2(new Vector2(120, 0), new Vector2(120, 120));
            break;

        case YokaiActionType.ElementalAttack:
            Modulate       = Colors.White;
            Sprite.Texture = Arrows[(int)action.Element - 1];
            break;

        default:
            GD.PrintErr($"{action} : This action's display has not been set");
            break;
        }
        if (action.IsBlocked)
        {
            Modulate = Colors.White;
            ((ShaderMaterial)Sprite.Material).SetShaderParam("blockAction", true);
        }
        else
        {
            ((ShaderMaterial)Sprite.Material).SetShaderParam("blockAction", false);
        }
    }
Пример #3
0
    public void PlanNextTurn()
    {
        ActionPlan = Enumerable.Repeat(new YokaiAction(YokaiActionType.None), BattleScene.SealCount).ToList();
        YokaiData data  = Yokai.Data();
        int       level = data.Level;

        switch (data.Pattern)
        {
        case Pattern.Default:
        case Pattern.Vertical:
            if (CardEffectHelper.NonEmptySealsCount() > BattleScene.SealCount / 4)
            {
                level += 1;
            }
            if (CardEffectHelper.NonEmptySealsCount() > BattleScene.SealCount / 2)
            {
                level += 1;
            }

            // Attacks the bottom seal, and remove some other seals
            int sideActionCount =
                (level < 2) ? 0 : (level < 4) ? 1 : (level < 6) ? 2 : (level < 8) ? 3 : 4;

            if (StaggerLevel > 0)
            {
                attackLocation = attackLocation.NextLocation();
            }

            ActionPlan[attackLocation] = new YokaiAction(
                (level < 1) ? YokaiActionType.None : (level < 3) ? YokaiActionType.Attack : YokaiActionType.ElementalAttack,
                data.Element, (StaggerLevel > 0));
            StaggerLevel -= 1;

            sideActionCount = Math.Min(sideActionCount, BattleScene.SealCount - 2);     //Prevent infinite loop

            var slots = Enumerable.Range(1, BattleScene.SealCount / 2 - 1).Concat(Enumerable.Range(BattleScene.SealCount / 2 + 1, BattleScene.SealCount / 2 - 1)).ToList();
            for (int i = 0; i < sideActionCount; i++)
            {
                int location = slots.Random();
                while (ActionPlan[location].Type != YokaiActionType.None)
                {
                    location = slots.Random();
                }
                ActionPlan[location] = new YokaiAction((BattleScene.SealSlots[location] == Element.None) ? YokaiActionType.Attack : YokaiActionType.Remove, (StaggerLevel > 0));
                StaggerLevel        -= 1;
            }

            ActionPlan[attackLocation.OppositeLocation()] = new YokaiAction(
                (level < 1) ? YokaiActionType.None : (level < 5) ? YokaiActionType.Attack : YokaiActionType.ElementalAttack,
                data.Element, (StaggerLevel > 0));

            break;

        case Pattern.Rotary:
            // Alternatively attacks and removes seals
            // Evenly distribute the actions around the yokai
            if (CardEffectHelper.NonEmptySealsCount() > BattleScene.SealCount / 4)
            {
                level += 1;
            }
            if (CardEffectHelper.NonEmptySealsCount() > BattleScene.SealCount / 3)
            {
                level += 1;
            }
            if (CardEffectHelper.NonEmptySealsCount() > BattleScene.SealCount / 2)
            {
                level += 1;
            }

            int rotaryActionCount = level
                                    switch { 0 => 1, 1 => 2, 2 => 2, 3 => 3, 4 => 3, 5 => 4, 6 => 4, 7 => 6, _ => 6, };
            int nSuperAttacks = level
                                switch { 0 => 0, 1 => 0, 2 => 1, 3 => 1, 4 => 2, 5 => 2, 6 => 3, 7 => 3, 8 => 4, 9 => 5, _ => 6 };
            nSuperAttacks -= staggerLevel;

            YokaiActionType action = (TurnCount % 2 == 0) ? YokaiActionType.Attack : YokaiActionType.Remove;

            int distanceBetweenActions = BattleScene.SealCount / rotaryActionCount;

            attackLocation = RNG.Get.Next(0, distanceBetweenActions);

            for (int i = 0; i < rotaryActionCount; i++)
            {
                bool isBlocked = (StaggerLevel > 0);
                StaggerLevel--;
                bool isSupperAttack = (RNG.Get.Next(0, rotaryActionCount - i) < nSuperAttacks);
                if (isSupperAttack)
                {
                    nSuperAttacks--;
                }
                ActionPlan[attackLocation + i * BattleScene.SealCount / rotaryActionCount] = new YokaiAction(isSupperAttack ? YokaiActionType.ElementalAttack : action, data.Element, isBlocked);
            }
            break;
        }
        staggerLevel = 0;
        Incinerate   = false;
        BattleScene.SealingCircle.DisplayActionPlan(ActionPlan);
    }