Esempio n. 1
0
 public EffectHolder(CardGameState GS, bool Shared, int OwnerIndex)
 {
     TheCardGameState = GS;
     this.Shared      = Shared;
     this.OwnerIndex  = OwnerIndex;
     mCardZoneType    = new CardZoneType(Shared ? ZoneType.SharedEffect : ZoneType.Effect, Range.NA, OwnerIndex);
 }
Esempio n. 2
0
    /// <summary>
    /// カードゾーンタイプに対応するCardZoneを返す
    /// </summary>
    /// <param name="type">探すCardZoneの種類</param>
    /// <param name="p">CardZoneを保持するプレイヤー</param>
    /// <returns>探したCardZone 存在しないならnull</returns>
    public CardZone GetCardZone(CardZoneType type, Player p = null)
    {
        if (p == null && isPlayerHaveZone(type))
        {
            return(null);
        }
        switch (type)
        {
        case CardZoneType.Deck:
            return(Field.GetDeckZone());

        case CardZoneType.Draft:
            return(Field.GetDraftZone());

        case CardZoneType.Dest:
            return(Field.GetDisCardZone());

        case CardZoneType.Hand:
            return(p.GetHandZone());

        case CardZoneType.Unit:
            return(p.GetUnitZone());

        case CardZoneType.Support:
            return(p.GetSupportZone());

        default: return(null);
        }
    }
Esempio n. 3
0
        public override List <Actions.ActionOrder> GetAIActions(CardGameState gameState, TurnInfo TI)
        {
            List <Actions.ActionOrder> results = new List <Actions.ActionOrder>();

            if (!IsPlaced)
            {
                CardZoneType   effectCardZoneType = mIsShared ? gameState.SharedEffects.mCardZoneType : Owner.mEffects.mCardZoneType;
                Actions.Action placeCardAction    = new Actions.PlaceCard_Action(this, effectCardZoneType);
                if (placeCardAction.CheckValidity(null, null, TI))
                {
                    results.Add(new Actions.ActionOrder(placeCardAction, null, null));
                }
            }
            else
            {
                foreach (Actions.ActionInfo AI in GetActions())
                {
                    if (AI.mAction.IsAvailable(this))
                    {
                        foreach (Actions.ActionOrder AO in AI.GetPossibleActionOrders(gameState, this))
                        {
                            if (AO.Action.CheckValidity(AO.Performer, AO.Selection, TI))
                            {
                                results.Add(AO);
                            }
                        }
                    }
                }
            }
            return(results);
        }
Esempio n. 4
0
 /// <summary>
 /// 引数のタイプの場がプレイヤーごとに保持するものか確認
 /// </summary>
 /// <param name="type">確認する場の種類</param>
 /// <returns>その場がプレイヤーが保持するタイプか否か</returns>
 private bool isPlayerHaveZone(CardZoneType type)
 {
     if (type == CardZoneType.Hand || type == CardZoneType.Support || type == CardZoneType.Unit)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
 public override void Placed(CardZoneType CZ, CardList CL, CardGameState GS)
 {
     IsPlaced = true;
     Zone     = CZ;
     CL.AddCard(this);
     AddStatus("Placed this turn");
     if (GS.mTurnInfo.IsFirstDeployment())
     {
         AddStatus("Deployed");
     }
 }
Esempio n. 6
0
 /// <summary>
 /// 引数のZoneTypeが対象に含まれるか確認
 /// </summary>
 /// <param name="value">確認する場の種類</param>
 /// <returns></returns>
 private bool isTargetZone(CardZoneType value)
 {
     foreach (CardZoneType zone in targetZone)
     {
         if (zone == value)
         {
             return(true);
         }
     }
     return(false);
 }
        public void CardPlaced(UICard inPlacedCard, CardZoneType PlacedZone)
        {
            PlayingCard PlacedCard = (PlayingCard)inPlacedCard;

            if (!SecondSelect)
            {
                SendAction(new ActionOrder(new PlaceCard_Action(PlacedCard.GetEntity(), PlacedZone), null, null));
            }
            UpdateUI();
            if ((PlacedCard).IsPlaced() && PlacedCard.GetEntity().PAHolder.HasAction())
            {
                StartPlacedAction(PlacedCard);
            }
        }
Esempio n. 8
0
 public override bool CanBePlaced(TurnInfo TI, CardZoneType CZ)
 {
     if (TI.IsDeployment())
     {
         return(false);
     }
     if (mIsShared)
     {
         return(CZ.getType() == ZoneType.SharedEffect);
     }
     else
     {
         return(CZ.getType() == ZoneType.Effect && CZ.getOwnerIndex() == GetOwnerIndex());
     }
 }
        public override void Execute(Entities.Entity Performer, List <Entities.Entity> Selection, CardGameState GS)
        {
            if (mUniqueEntity)
            {
                bool isUnique = true;
                if (mRange != Range.NA)
                {
                    foreach (Entity E in Performer.Owner.mBoard.RangeZones[(int)mRange].List.Cards)
                    {
                        if (E.Name == mSpawnEntityName)
                        {
                            isUnique = false;
                        }
                    }
                }
                else if (mZoneType == ZoneType.Effect)
                {
                    foreach (Effects.EffectNode EN in Performer.Owner.mEffects.Nodes)
                    {
                        if (EN.UniqueName == mSpawnEntityName)
                        {
                            isUnique = false;
                        }
                    }
                }
                if (!isUnique)
                {
                    return;
                }
            }

            Entities.Entity[] spawnedEnities = new Entities.Entity[mSpawnEntityNumber];
            CardZoneType      zoneToPlace    = new CardZoneType(mZoneType, mRange, Performer.GetOwnerIndex());

            for (int i = 0; i < mSpawnEntityNumber; i++)
            {
                spawnedEnities[i]       = Loading.CardLoading.ProduceCard(mSpawnEntityName, State.StateHolder.StateManager.CardPool);
                spawnedEnities[i].Owner = Performer.Owner;
                spawnedEnities[i].SetIsGeneratedEntity();
                GS.CardPlaced(zoneToPlace, spawnedEnities[i]);
            }
        }
        public void CardPlaced(UICard PlacedCard, CardZoneType PlacedZone)
        {
            if (PlacedCard.GetEntity().IsUnit() == (PlacedZone.getType() == ZoneType.Field))
            {
                RemoveFromList(PlacedCard.GetEntity());
                // Hack? Use owner index to specify whether this
                // is a deck zone or a library zone.
                // 0 = Deck
                // 1 = Library
                if (PlacedZone.getOwnerIndex() == 0)
                {
                    mDeckCards.AddCard(PlacedCard.GetEntity());
                }
                else
                {
                    mLibraryCards.AddCard(PlacedCard.GetEntity());
                }

                if (VerifyDeck())
                {
                    UpdateCardCollection();
                }
            }
        }
Esempio n. 11
0
        public override void Placed(CardZoneType CZ, CardList CL, CardGameState GS)
        {
            Effects.EffectHolder targetHolder;
            if (mIsShared)
            {
                targetHolder = GS.SharedEffects;
            }
            else
            {
                targetHolder = GS.Players[GetOwnerIndex()].mEffects;
            }

            // Only one effect with a given name allowed
            bool isUnique = true;

            foreach (Effects.EffectNode EN in targetHolder.Nodes)
            {
                if (EN.UniqueName == EData.UniqueName)
                {
                    isUnique = false;
                }
            }

            if (isUnique)
            {
                IsPlaced = true;
                Zone     = CZ;
                Node.CreateEffect(EData);
                targetHolder.AddNode(Node);
            }
            else
            {
                Owner.RemoveFromList(this);
                RemovedFromBoard();
            }
        }
Esempio n. 12
0
    public int GetPoint(Player player, Card card, CardZoneType zone, ref GameObject target)
    {
        int p = 0;

        //カードのコストによる評価値の取得
        if (zone == CardZoneType.Hand)
        {
            p -= card.State.Cost * cost_value;
        }

        //カード効果による評価値の取得
        foreach (CardEffect effect in card.State.Effect)
        {
            switch (effect.GetEffectPlayType())
            {
            case EffectPlayType.playEffect:
                if (zone != CardZoneType.Unit && zone != CardZoneType.Support)      //既に場に出ているカードは発動時効果の評価値を計算しない
                {
                    foreach (EffectState estate in effect.effectState)
                    {
                        switch (estate.effectType)
                        {
                        case EffectType.AttackTime:
                            if (player.Buff.GetMaxAtkCount() < estate.value)
                            {
                                p += GetAttackPoint(estate.value) - GetAttackPoint(player.Buff.GetMaxAtkCount());        //(estate.value - 1) * (playerState.atk * AIConstants.ATTACK_POINT);
                            }
                            break;

                        case EffectType.CardDraw:
                            p += estate.value * AIConstants.CARD_POINT_REVERS;
                            break;

                        case EffectType.CardDraft:
                            if (estate.Target.targetZone[0] == CardZoneType.Deck)        //山札を参照するとドローまで呼んでしまうので参照しない
                            {
                                p += AIConstants.CARD_POINT_REVERS;
                            }
                            else
                            {
                                List <GameObject> targets = estate.GetCanSelectTargets(player);
                                int max = 0;
                                int now = 0;
                                foreach (GameObject go in targets)
                                {
                                    if (go.GetComponent <Card>())
                                    {
                                        now = GetPoint(player, go.GetComponent <Card>(), CardZoneType.Hand);
                                        if (now < max)
                                        {
                                            max = now;
                                        }
                                    }
                                }
                                p += max;
                            }
                            break;

                        case EffectType.CardUnDraft:
                            p += (estate.value - 1) * AIConstants.CARD_POINT_REVERS;
                            break;

                        case EffectType.Damage:
                            int damageScore = 0, totalScore = 0;
                            int damageValue = (card.State.cardType == ObjectType.Skill ? estate.value + player.SkillDamage : estate.value);

                            target = GetMostAttackTarget(estate.GetCanSelectTargets(player), damageValue, ref damageScore, ref totalScore);
                            if (estate.Target.isAll)
                            {
                                p += totalScore;
                            }
                            else
                            {
                                p += damageScore;
                            }
                            break;

                        case EffectType.CostAdd:
                            p += estate.value * AIConstants.COST_POINT;
                            break;
                        }
                    }
                }
                break;

            case EffectPlayType.staticEffect:
                foreach (EffectState estate in effect.effectState)
                {
                    switch (estate.effectType)
                    {
                    case EffectType.Guardian: break;
                    }
                }
                break;

            case EffectPlayType.activeEffect:
                foreach (EffectState estate in effect.effectState)
                {
                    switch (estate.effectType)
                    {
                    case EffectType.AttackAdd:
                        p += estate.value;
                        break;

                    case EffectType.CardDraft:
                        if (estate.Target.targetZone[0] == CardZoneType.Deck)        //山札を参照するとドローまで呼んでしまうので参照しない
                        {
                            p += AIConstants.CARD_POINT_REVERS;
                        }
                        else
                        {
                            List <GameObject> targets = estate.GetCanSelectTargets(player);
                            int max = 0;
                            int now = 0;
                            foreach (GameObject go in targets)
                            {
                                if (go.GetComponent <Card>())
                                {
                                    now = GetPoint(player, go.GetComponent <Card>(), CardZoneType.Hand);
                                    if (now < max)
                                    {
                                        max = now;
                                    }
                                }
                            }
                            p += max;
                        }
                        break;
                    }
                }
                break;

            case EffectPlayType.triggerEffect:
                foreach (EffectState estate in effect.effectState)
                {
                    switch (estate.effectType)
                    {
                    case EffectType.AttackAdd:
                        p += GetAttackPoint(player.Buff.GetMaxAtkCount(), player.AttackPower) - GetAttackPoint(player.Buff.GetMaxAtkCount(), player.AttackPower + estate.value);
                        break;
                    }
                }
                break;

            default:
                break;
            }
        }

        if (card.State.atk > 0)
        {
            p += GetAttackPoint(player.Buff.GetMaxAtkCount(), player.AttackPower + card.State.atk) - GetAttackPoint(player.Buff.GetMaxAtkCount(), player.AttackPower);
        }

        if (card.State.skill > 0)
        {
            p += card.State.skill * AIConstants.SKILL_POINT;
        }


        return(p);
    }
 public void CardPlaced(UICard PlacedCard, CardZoneType PlacedZone)
 {
 }
Esempio n. 14
0
 public PlaceCard_Action(Entity PlacedCard, CardZoneType PlacedZone)
 {
     this.PlacedCard = PlacedCard;
     this.PlacedZone = PlacedZone;
 }
Esempio n. 15
0
 abstract public void Placed(CardZoneType CZ, CardList CL, CardGameState GS);
Esempio n. 16
0
 abstract public bool CanBePlaced(TurnInfo TI, CardZoneType CZ);
Esempio n. 17
0
 public Target(TargetType targetType, CardZoneType targetZone, List <ObjectType> targetObjectType, bool isAll)
 {
     this.targetType = targetType; this.targetZone.Add(targetZone); this.targetObjectType = targetObjectType; this.isAll = isAll;
 }
Esempio n. 18
0
 //Listでない初期化子のみ
 public Target(TargetType targetType, CardZoneType targetZone, ObjectType targetObjectType, bool isAll = true, CardAligment targetAligment = CardAligment.All)
 {
     this.targetType = targetType; this.targetZone.Add(targetZone); this.targetObjectType.Add(targetObjectType); this.isAll = isAll; this.targetAligment = targetAligment;
 }
Esempio n. 19
0
 public override bool CanBePlaced(TurnInfo TI, CardZoneType CZ)
 {
     return(CZ.getType() == ZoneType.Field && CZ.getOwnerIndex() == GetOwnerIndex() && CanBeRange(CZ.getRange()));
 }
Esempio n. 20
0
 public bool CanBePlaced(TurnInfo TI, CardZoneType CZ)
 {
     return(mEntity.CanBePlaced(TI, CZ));
 }
Esempio n. 21
0
    /// <summary>
    /// カードの評価点を計算する処理
    /// </summary>
    /// <param name="player">対象カードを保持するプレイヤー</param>
    /// <param name="card">対象のカード</param>
    /// <param name="zone">対象のカードが存在する場</param>
    /// <returns></returns>
    public int GetPoint(Player player, Card card, CardZoneType zone)
    {
        GameObject damy = null;

        return(GetPoint(player, card, zone, ref damy));
    }