public QuadMistCard RemoveSelected() { QuadMistCard quadMistCard = this.list[this.select]; this.Remove(quadMistCard); return(quadMistCard); }
public QuadMistCardUI GetCardUI(QuadMistCard card) { QuadMistCardUI result = (QuadMistCardUI)null; this.hash.TryGetValue(card, out result); return(result); }
public static Int32 MiniGame_AwayCard(Int32 cardId, Int32 cardIndex) { List <QuadMistCard> miniGameCard = FF9StateSystem.MiniGame.SavedData.MiniGameCard; QuadMistCard quadMistCard = (QuadMistCard)null; Int32 num = 0; foreach (QuadMistCard quadMistCard2 in miniGameCard) { if ((Int32)quadMistCard2.id == cardId) { if (num == cardIndex) { quadMistCard = quadMistCard2; break; } num++; } } if (quadMistCard != null) { miniGameCard.Remove(quadMistCard); FF9StateSystem.MiniGame.SavedData.MiniGameCard = miniGameCard; return(0); } return(-1); }
private static void LogDiscardingCard(QuadMistCard card) { String cardName = FF9TextTool.CardName(card.id); String displayInfo = card.ToString(); Int32 arrowCount = MathEx.BitCount(card.arrow); Log.Message($"Discard the card: {cardName} ({displayInfo}, {arrowCount} arrows) [Id: {card.id}, Type: {card.type}, Attack: {card.atk}, P.Def: {card.pdef}, M.Def: {card.mdef}]"); }
public void Initialize(Hand hand) { hand.Clear(); for (Int32 i = 0; i < 5; i++) { QuadMistCard quadMistCard = CardPool.CreateQuadMistCard(this.GetCardID()); quadMistCard.side = 1; hand.Add(quadMistCard); } }
public static void Remove(QuadMistCard card) { foreach (QuadMistCard quadMistCard in QuadMistDatabase.instance.data.MiniGameCard) { if (quadMistCard.id == card.id) { QuadMistDatabase.instance.data.MiniGameCard.Remove(quadMistCard); break; } } }
private void SelectCard(Int32 id, Int32 offset) { QuadMistCard cardInfo = this.GetCardInfo(id, offset); this.selectedCardList.Add(cardInfo); QuadMistUI.allCardList.Remove(cardInfo); Byte[] array = this.count; array[id] = (Byte)(array[id] - 1); QuadMistGame.UpdateSelectedCardList(this.selectedCardList); this.DisplayCardList(); }
public QuadMistCard(QuadMistCard card) { this.id = card.id; this.side = card.side; this.atk = card.atk; this.type = card.type; this.pdef = card.pdef; this.mdef = card.mdef; this.cpoint = card.cpoint; this.arrow = card.arrow; }
public static Int32 GetCardCount(QuadMistCard card) { Int32 num = 0; foreach (QuadMistCard quadMistCard in QuadMistDatabase.instance.data.MiniGameCard) { if (quadMistCard.id == card.id) { num++; } } return(num); }
private void DeselectCard(Int32 index) { QuadMistCard quadMistCard = this.selectedCardList[index]; this.selectedCardList.Remove(quadMistCard); QuadMistUI.allCardList.Add(quadMistCard); Byte[] array = this.count; Byte id = quadMistCard.id; array[(Int32)id] = (Byte)(array[(Int32)id] + 1); QuadMistGame.UpdateSelectedCardList(this.selectedCardList); this.DisplayCardList(); }
public Vector2 GetCardLocation(QuadMistCard card) { for (Int32 i = 0; i < Board.SIZE_X; i++) { for (Int32 j = 0; j < Board.SIZE_Y; j++) { if (card == this[i, j]) { return(new Vector2((Single)i, (Single)j)); } } } return(new Vector2(-1f, -1f)); }
public override void HandleTargetCardSelection(Board board, QuadMistCard origin, List <QuadMistCard> selectable, ref InputResult result) { if (this.strictActiveInputHandler != InputDelegatorHandler.InputType.None) { this.inputs[(Int32)this.strictActiveInputHandler].HandleTargetCardSelection(board, origin, selectable, ref result); } else { foreach (InputHandler inputHandler in this.inputs) { inputHandler.HandleTargetCardSelection(board, origin, selectable, ref result); } } }
public static Int32 MiniGame_SetCard(Int32 ID) { if (QuadMistDatabase.MiniGame_GetAllCardCount() >= 100) { return(-1); } QuadMistCard item = CardPool.CreateQuadMistCard(ID); FF9StateSystem.MiniGame.SavedData.MiniGameCard.Add(item); if (QuadMistDatabase.MiniGame_GetCardCount(ID) == 1) { return(1); } return(0); }
public static QuadMistCard CreateQuadMistCard(Int32 id) { QuadMistCard quadMistCard = new QuadMistCard(); quadMistCard = new QuadMistCard(CardPool.GetMaxStatCard(id)); quadMistCard.atk = (Byte)((Int32)(quadMistCard.atk / 2) + UnityEngine.Random.Range(0, (Int32)(quadMistCard.atk / 2))); quadMistCard.pdef = (Byte)((Int32)(quadMistCard.pdef / 2) + UnityEngine.Random.Range(0, (Int32)(quadMistCard.pdef / 2))); quadMistCard.mdef = (Byte)((Int32)(quadMistCard.mdef / 2) + UnityEngine.Random.Range(0, (Int32)(quadMistCard.mdef / 2))); quadMistCard.arrow = CardPool.RandomCardArrow(); if (UnityEngine.Random.Range(0, 127) == 0) { quadMistCard.type = QuadMistCard.Type.FLEXIABLE; } return(quadMistCard); }
public override void HandlePreSelection(PreBoard preBoard, Hand playerHand, ref InputResult result) { if (Input.GetMouseButtonUp(0)) { Vector3 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); Int32 indexByWorldPoint = preBoard.GetIndexByWorldPoint(worldPoint); if (indexByWorldPoint >= 0) { preBoard.SetPreviewCardID(indexByWorldPoint); } else { if (preBoard.GetPreviewByWorldPoint(worldPoint)) { if (playerHand.Count != 5) { QuadMistCard item = preBoard.RemoveSelected(); playerHand.Add(item); if (playerHand.Count == 5) { result.Used(); return; } } else if (playerHand.Count == 5) { result.Used(); return; } } Int32 lrbyWorldPoint = preBoard.GetLRByWorldPoint(worldPoint); if (lrbyWorldPoint == 1) { preBoard.NextCard(); } if (lrbyWorldPoint == -1) { preBoard.PrevCard(); } } Int32 indexByWorldPoint2 = playerHand.GetIndexByWorldPoint(worldPoint); if (indexByWorldPoint2 >= 0) { preBoard.Add(playerHand[indexByWorldPoint2]); playerHand.RemoveAt(indexByWorldPoint2); } } }
public void PrevCard() { if (this.list.Count == 0) { return; } this.select--; if (this.select == -1) { this.select = this.list.Count - 1; } this.cardPreview.Preview = this.list[this.select]; this.cardPreview.Count = this.list.Count; this.cardPreview.SetTextSelect(this.select, this.list.Count); this.cardPreview.Prev(); }
private void UpdatePreview() { if (this.list.Count > 0) { this.select = 0; this.cardPreview.gameObject.SetActive(true); this.cardPreview.Preview = this.list[this.select]; this.cardPreview.Count = this.list.Count; this.cardPreview.SetTextID(this.listIndex); this.cardPreview.SetTextSelect(this.select, this.list.Count); } else { this.cardPreview.gameObject.SetActive(false); } }
public void NextCard() { if (this.list.Count == 0) { return; } this.select++; if (this.select == this.list.Count) { this.select = 0; } this.cardPreview.Preview = this.list[this.select]; this.cardPreview.Count = this.list.Count; this.cardPreview.SetTextSelect(this.select, this.list.Count); this.cardPreview.Next(); }
public QuadMistCard[] GetAdjacentCards(Int32 x, Int32 y) { QuadMistCard[] array = new QuadMistCard[CardArrow.MAX_ARROWNUM]; for (Int32 i = 0; i < CardArrow.MAX_ARROWNUM; i++) { Vector3 vector = CardArrow.ToOffset((CardArrow.Type)i); QuadMistCard quadMistCard = this[(Int32)((Single)x + vector.x), (Int32)((Single)y + vector.y)]; if (quadMistCard != null && !quadMistCard.IsBlock) { array[i] = quadMistCard; } else { array[i] = (QuadMistCard)null; } } return(array); }
private void OnClickSelectedCard(GameObject go) { Int32 siblingIndex = go.transform.GetSiblingIndex(); if (siblingIndex < this.selectedCardList.Count) { FF9Sfx.FF9SFX_Play(101); QuadMistCard quadMistCard = this.selectedCardList[siblingIndex]; this.selectedCardList.RemoveAt(siblingIndex); QuadMistUI.allCardList.Add(quadMistCard); Byte[] array = this.count; Byte id = quadMistCard.id; array[(Int32)id] = (Byte)(array[(Int32)id] + 1); QuadMistGame.UpdateSelectedCardList(this.selectedCardList); this.DisplayCardList(); this.DisplayCardDetail(); } }
public Boolean isTheSameCard(QuadMistCard card) { global::Debug.Log(String.Concat(new Object[] { "isTheSameCard 1 current card: id = ", this.id, ", atk = ", this.atk, ", arrow = ", this.arrow, ", type = ", this.type, ", pdef = ", this.pdef, ", mdef = ", this.mdef })); global::Debug.Log(String.Concat(new Object[] { "isTheSameCard 2 taken card: id = ", card.id, ", atk = ", card.atk, ", arrow = ", card.arrow, ", type = ", card.type, ", pdef = ", card.pdef, ", mdef = ", card.mdef })); if (this.id == card.id && this.atk == card.atk && this.arrow == card.arrow && this.type == card.type && this.pdef == card.pdef && this.mdef == card.mdef) { global::Debug.Log("isTheSameCard 3 return true"); return(true); } global::Debug.Log("isTheSameCard 4 return false"); return(false); }
private Int32 Check(Board board, QuadMistCard yourCard, Vector2 origin, out QuadMistCard target) { target = (QuadMistCard)null; QuadMistCard[] adjacentCards = board.GetAdjacentCards((Int32)origin.x, (Int32)origin.y); Int32 num = 0; Int32 num2 = 0; for (Int32 i = 0; i < (Int32)adjacentCards.Length; i++) { if (adjacentCards[i] != null) { QuadMistCard quadMistCard = adjacentCards[i]; if (quadMistCard.side != yourCard.side) { Int32 num3 = CardArrow.CheckDirection(yourCard.arrow, quadMistCard.arrow, (CardArrow.Type)i); if (num3 == 1) { num++; } if (num3 == 2) { if (target == null) { target = adjacentCards[i]; } num2++; } } } } if (num2 != 0) { return(-num2); } if (num != 0) { return(num); } return(0); }
private static FF9SAVE_MINIGAME DoDeepCopyWidhCardsAlwaysBeYours(FF9SAVE_MINIGAME originalData) { FF9SAVE_MINIGAME ff9SAVE_MINIGAME = new FF9SAVE_MINIGAME(); ff9SAVE_MINIGAME.sWin = originalData.sWin; ff9SAVE_MINIGAME.sLose = originalData.sLose; ff9SAVE_MINIGAME.sDraw = originalData.sDraw; foreach (QuadMistCard quadMistCard in originalData.MiniGameCard) { QuadMistCard quadMistCard2 = new QuadMistCard(); quadMistCard2.id = quadMistCard.id; quadMistCard2.side = 0; quadMistCard2.atk = quadMistCard.atk; quadMistCard2.type = quadMistCard.type; quadMistCard2.pdef = quadMistCard.pdef; quadMistCard2.mdef = quadMistCard.mdef; quadMistCard2.cpoint = quadMistCard.cpoint; quadMistCard2.arrow = quadMistCard.arrow; ff9SAVE_MINIGAME.MiniGameCard.Add(quadMistCard2); } return(ff9SAVE_MINIGAME); }
private void FF9FCard_GetPoint() { List <QuadMistCard> list = QuadMistDatabase.MiniGame_GetCardBinPtr(); Boolean[] array = new Boolean[CardUI.FF9FCARD_ARROW_TYPE_MAX]; Int32 num = 0; Int32 num2 = 0; Int32 num3 = 0; Byte[] array2 = new Byte[] { 0, 0, 1, 2 }; foreach (QuadMistCard quadMistCard in list) { num += (Int32)quadMistCard.cpoint; } for (Int32 i = 0; i < 100; i++) { for (Int32 j = 0; j < (Int32)this.count[i]; j++) { QuadMistCard quadMistCard2 = QuadMistDatabase.MiniGame_GetCardInfoPtr(i, j); array[(Int32)quadMistCard2.arrow] = true; num2 += (Int32)array2[(Int32)quadMistCard2.type]; } } for (Int32 k = 0; k < CardUI.FF9FCARD_ARROW_TYPE_MAX; k++) { if (array[k]) { num3 += 5; } } this.point = num + num2 + num3; }
private static Int32 CompareCard(QuadMistCard x, QuadMistCard y) { if (x.cpoint > y.cpoint) { return(1); } if (y.cpoint > x.cpoint) { return(-1); } if (x.type == QuadMistCard.Type.ASSAULT && y.type != QuadMistCard.Type.ASSAULT) { return(1); } if (y.type == QuadMistCard.Type.ASSAULT && x.type != QuadMistCard.Type.ASSAULT) { return(-1); } return((x.atk + x.pdef + x.mdef) * (x.type >= QuadMistCard.Type.FLEXIABLE ? 1.5 : 1).CompareTo( (y.atk + y.pdef + y.mdef) * (y.type >= QuadMistCard.Type.FLEXIABLE ? 1.5 : 1))); }
private static Boolean CanDiscard(QuadMistCard card) { if (Configuration.TetraMaster.DiscardExclusions.Contains(card.id)) { return(false); } if (card.type == QuadMistCard.Type.ASSAULT && !Configuration.TetraMaster.DiscardAssaultCards) { return(false); } if (card.type == QuadMistCard.Type.FLEXIABLE && !Configuration.TetraMaster.DiscardFlexibleCards) { return(false); } if (card.atk > Configuration.TetraMaster.DiscardMaxAttack) { return(false); } if (card.pdef > Configuration.TetraMaster.DiscardMaxPDef) { return(false); } if (card.mdef > Configuration.TetraMaster.DiscardMaxMDef) { return(false); } if (card.atk + card.pdef + card.mdef >= Configuration.TetraMaster.DiscardMaxSum) { return(false); } return(true); }
public abstract void HandleTargetCardSelection(Board board, QuadMistCard origin, List <QuadMistCard> selectable, ref InputResult result);
public void Remove(QuadMistCard c) { this.collection.Remove(c); this.UpdateCollection((Int32)c.id); this.UpdatePreview(); }
public static void RestorePlayerLostCard(Hand hand, Int32 cardArrayIndex, QuadMistCard lostCard) { hand.ReplaceCard(cardArrayIndex, lostCard); }
public QuadMistCard[] GetAdjacentCards(QuadMistCard card) { Vector2 cardLocation = this.GetCardLocation(card); return(this.GetAdjacentCards((Int32)cardLocation.x, (Int32)cardLocation.y)); }