/// <summary> /// 获得一套随机可用卡牌 /// </summary> public static Stack <String> GetRandomCardStack(int Seed) { Stack <String> Ramdom = new Stack <string>(); try { var cards = new List <String>(); foreach (var CardSN in CardUtility.ReadyCardDic.Keys) { if (CardSN.Substring(1, 1) == "0") { cards.Add(CardSN); } } var newList = CardUtility.RandomSort <String>(cards.ToArray(), Seed); for (int i = 0; i < Math.Min(MaxCards, newList.Length); i++) { Ramdom.Push(newList[i]); } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } return(Ramdom); }
public void OnRightChoice() { Debug.Log("Right"); CardUtility.ParseCardValues(this, m_CardInfo.cardData.right_value); CardUtility.ParseCardEvent(this, false); CardUtility.ParseNextCard(this, m_CardInfo.rightNextCard); }
private void CreateNewCardObject(int index, string cardStr) { if (cardStr != null) { float xOff = index * 11 + (((config.GameGridWidth - config.PlayerHandSize) / 2f) * 11); float yOff = -10; Vector3 finalPosition = new Vector3(xOff, yOff, 40); // If old card exists, destroy it GameObject oldCardObj = GameObject.Find(CardUtility.CreateCardObjectName("GameCard", this.id, index)); if (oldCardObj != null) { Debug.Log(debugTag + "Trying to destroy " + oldCardObj.name); Destroy(oldCardObj); } // Create new card // NOTE: In the future when there is an actual deck model, have it originate from that. GameObject cardObj = (GameObject)Instantiate(matchController.gameCardPrefab, new Vector3(0, -40, 40), Quaternion.identity); cardObj.GetComponent <CardViewController>().Card = JsonUtility.FromJson <Card>(cardStr); cardObj.transform.SetParent(GameObject.Find("PlayerHand").transform); StartCoroutine(CardAnimations.MoveCardCoroutine(cardObj, finalPosition, 0.1f)); cardObj.name = (CardUtility.CreateCardObjectName("GameCard", this.id, index)); } }
/// <summary> /// 抽牌【对方】 /// </summary> /// <param name="game"></param> /// <param name="Result"></param> private void DrawMyCard(ActionStatus game, List <string> Result) { if (string.IsNullOrEmpty(指定卡牌编号) || 指定卡牌编号 == CardUtility.strIgnore) { List <string> drawCards; if (SystemManager.游戏类型 == SystemManager.GameType.HTML版) { drawCards = GameServer.DrawCard(game.GameId, game.IsHost, 1); } else { drawCards = ClientRequest.DrawCard(game.GameId.ToString(GameServer.GameIdFormat), game.IsHost, 1); } if (drawCards.Count == 1) { game.AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(drawCards[0])); game.AllRole.MyPublicInfo.HandCardCount++; game.AllRole.MyPublicInfo.RemainCardDeckCount--; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strMe); } } else { game.AllRole.MyPrivateInfo.handCards.Add((CardUtility.GetCardInfoBySN(指定卡牌编号))); game.AllRole.MyPublicInfo.HandCardCount++; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strMe); } }
/// <summary> /// 随从卡牌 /// </summary> /// <param name="game"></param> /// <param name="CardSn"></param> /// <param name="AIParm"></param> /// <param name="card"></param> /// <param name="ActionCodeLst"></param> /// <param name="PlayInfo"></param> public static void RunCS(ActionStatus game, string MinionCardSN, int Position) { int MinionPos = Position; var minion = (MinionCard)CardUtility.GetCardInfoBySN(MinionCardSN); //初始化 minion.初始化(); //必须在放入之前做得原因是,被放入的随从不能被触发这个事件 game.AllRole.MyPublicInfo.BattleField.PutToBattle(MinionPos, minion); if (!string.IsNullOrEmpty(minion.战吼效果)) { SpellCard spell = (SpellCard)CardUtility.GetCardInfoBySN(minion.战吼效果); if (!spell.FirstAbilityDefine.IsNeedTargetSelect()) { game.Interrupt.Step = 1; game.Interrupt.SessionData = "MINIONPOSITION:" + MinionPos + "|"; UseSpellAction.RunBS(game, minion.战吼效果); } } game.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.召唤, 触发位置 = new CardUtility.指定位置结构体() { 位置 = MinionPos, 本方对方标识 = true } }); }
/// <summary> /// 抽牌【本方】 /// </summary> /// <param name="game"></param> /// <param name="Result"></param> private void DrawYourCard(ActionStatus game, List <string> Result) { if (string.IsNullOrEmpty(指定卡牌编号) || 指定卡牌编号 == CardUtility.strIgnore) { if (game.AllRole.YourPublicInfo.RemainCardDeckCount > 0) { if (SystemManager.游戏类型 == SystemManager.GameType.HTML版) { var drawCards = GameServer.DrawCard(game.GameId, !game.IsHost, 1); game.AllRole.YourPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(drawCards[0])); } game.AllRole.YourPublicInfo.HandCardCount++; game.AllRole.YourPublicInfo.RemainCardDeckCount--; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strYou); } } else { if (SystemManager.游戏类型 == SystemManager.GameType.HTML版) { game.AllRole.YourPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(指定卡牌编号)); } game.AllRole.YourPublicInfo.HandCardCount++; Result.Add(ActionCode.strCard + CardUtility.strSplitMark + CardUtility.strYou + CardUtility.strSplitMark + 指定卡牌编号); } }
/// <summary> /// GetOkResponse /// </summary> /// <param name="CardSN"></param> /// <param name="resume"></param> /// <returns></returns> private static string GetOkResponse(string CardSN, Control.FullServerManager.Interrupt resume) { string Response; switch (CardUtility.GetCardInfoBySN(CardSN).卡牌种类) { case Card.CardBasicInfo.资源类型枚举.随从: resume.ExternalInfo = "MINION"; break; case Card.CardBasicInfo.资源类型枚举.法术: resume.ExternalInfo = "SPELL"; break; case Card.CardBasicInfo.资源类型枚举.武器: resume.ExternalInfo = "WEAPON"; break; case Card.CardBasicInfo.资源类型枚举.奥秘: resume.ExternalInfo = "SECRET"; break; case Card.CardBasicInfo.资源类型枚举.其他: break; default: break; } Response = resume.ToJson(); Response = CardUtility.strOK + Response; return(Response); }
public void SetUtilityText() { CardUtility card = cardDataBase.FindUtilityCardByID(cardID); // set description text GameObject descriptionText = description.gameObject.transform.GetChild(0).gameObject; TextMesh descriptionTextR = descriptionText.GetComponent <TextMesh>(); descriptionTextR.text = card.decription; // set banner and name text SpriteRenderer bannerSR = banner.GetComponent <SpriteRenderer>(); GameObject nameText = banner.gameObject.transform.GetChild(0).gameObject; TextMesh nameTextR = nameText.GetComponent <TextMesh>(); bannerSR.sprite = utilityBanner; nameTextR.text = card.name; // Set the left Icon Destroy(leftIcon); // Set the Right Icon SpriteRenderer rightIconSR = rightIcon.GetComponent <SpriteRenderer>(); rightIconSR.sprite = costIcon; GameObject rightIconText = rightIcon.gameObject.transform.GetChild(0).gameObject; TextMesh rightIconTextR = rightIconText.GetComponent <TextMesh>(); rightIconTextR.text = card.apCost + ""; // Set the left bonus one icon Destroy(leftBonusIconOne); // Set the left bonus two icon Destroy(leftBonusIconTwo); }
private static void Combo(ActionStatus actionStatus, CardBasicInfo card, List <string> ActionCodeLst, PublicInfo PlayInfo) { if ((card.卡牌种类 != CardBasicInfo.资源类型枚举.法术) && PlayInfo.连击状态 && (!string.IsNullOrEmpty(card.连击效果))) { //初始化 Buff效果等等 SpellCard ablity = (SpellCard)CardUtility.GetCardInfoBySN(card.连击效果); if (ablity != null) { var ResultArg = ablity.UseSpell(actionStatus); if (ResultArg.Count != 0) { ActionCodeLst.AddRange(ResultArg); //英雄技能等的时候,不算[本方施法] if (ablity.法术卡牌类型 == CardBasicInfo.法术卡牌类型枚举.普通卡牌) { actionStatus.battleEvenetHandler.事件池.Add(new EventCard.全局事件() { 触发事件类型 = EventCard.事件类型枚举.施法, 触发位置 = PlayInfo.Hero.战场位置 }); } } } } }
// [Client/Server] public void CreateMarketGridObjects() { InitMarketGrid(); GameObject marketGridParent = new GameObject("MarketGrid"); for (int x = 0; x < Mathf.CeilToInt(((float)ResourceInfo.resources.Count - 1) / (float)config.GameGridHeight); x++) { for (int y = 0; y < config.GameGridHeight; y++) { if (masterMarketGrid[x, y] != null) { float xOff = ((config.GameGridWidth + 1) * cardOffX) + x * cardOffX; float yOff = y * cardOffY; GameObject cardObj = (GameObject)Instantiate(matchController.marketCardPrefab, new Vector3(xOff, yOff, 50), Quaternion.identity); cardObj.name = (CardUtility.CreateCardObjectName("Market", x, y)); cardObj.transform.SetParent(marketGridParent.transform); masterMarketGrid[x, y].CardObject = cardObj; // Physical representation } } } }
/// <summary> /// 新的回合 /// </summary> public void TurnStart(bool IsMyTurn) { PublicInfo PlayInfo = IsMyTurn ? actionStatus.AllRole.MyPublicInfo : actionStatus.AllRole.YourPublicInfo; if (IsMyTurn) { actionStatus.AllRole.MyPrivateInfo.handCards.Add(CardUtility.GetCardInfoBySN(ClientRequest.DrawCard(GameId.ToString(GameServer.GameIdFormat), IsHost, 1)[0])); } //过载的清算 if (PlayInfo.OverloadPoint != 0) { PlayInfo.crystal.ReduceCurrentPoint(PlayInfo.OverloadPoint); PlayInfo.OverloadPoint = 0; } //连击的重置 PlayInfo.连击状态 = false; //魔法水晶的增加 PlayInfo.crystal.NewTurn(); PlayInfo.Hero.RemainAttackTimes = 1; PlayInfo.Hero.IsUsedHeroAbility = false; PlayInfo.BattleField.FreezeStatus(); //重置攻击次数,必须放在状态变化之后! //原因是剩余攻击回数和状态有关! foreach (var minion in PlayInfo.BattleField.BattleMinions) { if (minion != null) { minion.重置剩余攻击次数(); } } }
// [Client with Server-Only section] public void CreateGameGridObjects() { GameObject gridParent = new GameObject("MainGrid"); for (int x = 0; x < config.GameGridWidth; x++) { for (int y = 0; y < config.GameGridHeight; y++) { float xOff = x * cardOffX; float yOff = y * cardOffY; GameObject cardObj = Instantiate(matchController.landTilePrefab, new Vector3(xOff, yOff, 50), Quaternion.identity); // cardObj.GetComponent<Animator>().Play("Flip"); cardObj.name = (CardUtility.CreateCardObjectName("Tile", x, y)); cardObj.transform.SetParent(gridParent.transform); cardObj.transform.rotation = new Quaternion(0, 180, 0, 0); // 0, 180, 0, 0 knownOwnersGrid[x, y] = new CardData(); if (hasAuthority) { masterGrid[x, y].CardObject = cardObj; } } } }
public void OnLeftChoice() { Debug.Log("Left"); CardUtility.ParseCardValues(this, m_CardInfo.cardData.left_value); CardUtility.ParseCardEvent(this, true); CardUtility.ParseNextCard(this, m_CardInfo.leftNextCard); }
public void PlayCard(int id) // Play a card { currentDiscard.Add(id); // if( discard > 0 ) make discard pile visable // make discard pile sprite be last discarded card //currentHand.RemoveAt(randomCard); if (id < 1000) // If the card is a melee card { SO_CardMelee card = cardDataBase.FindMeleeCardByID(id); Melee(id, card.normalDamage, card.bluntDamage, card.piercingDamage, card.poisonDamage); PrintLog("you just played " + card.name, "green"); } else if (id < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(id); Defence(id, card.armorBonus, card.spickedBonus); PrintLog("you just played " + card.name, "green"); } else if (id < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(id); PrintLog("you just played " + card.name, "green"); Utility(id); } else if (id < 4000) { CardCurse card = cardDataBase.FindCurseCardByID(id); PrintLog("You got cursed by" + card.name, "red"); card.PlayedFunction(); } }
public string DealMinion(ActionStatus game, MinionCard Minion) { var Pos = Minion.战场位置; if (Pos.本方对方标识) { if (game.AllRole.MyPrivateInfo.handCards.Count != SystemManager.MaxHandCardCount) { game.AllRole.MyPrivateInfo.handCards.Add( CardUtility.GetCardInfoBySN(game.AllRole.MyPublicInfo.BattleField.BattleMinions[Pos.位置 - 1].序列号) ); } game.AllRole.MyPublicInfo.BattleField.BattleMinions[Pos.位置 - 1] = null; } else { if (game.AllRole.YourPrivateInfo.handCards.Count != SystemManager.MaxHandCardCount) { game.AllRole.YourPrivateInfo.handCards.Add( CardUtility.GetCardInfoBySN(game.AllRole.YourPublicInfo.BattleField.BattleMinions[Pos.位置 - 1].序列号) ); } game.AllRole.YourPublicInfo.BattleField.BattleMinions[Pos.位置 - 1] = null; } return(String.Empty); }
private void btnEdit_Click(object sender, EventArgs e) { //编辑项目 if (lstCards.SelectedItems.Count == 1) { CardBasicInfo EditCard = CardUtility.GetCardInfoBySN(lstCards.SelectedItems[0].Text); switch (EditCard.卡牌种类) { case CardBasicInfo.资源类型枚举.随从: (new MinionCardEditor(EditCard.序列号)).ShowDialog(); break; case CardBasicInfo.资源类型枚举.法术: break; case CardBasicInfo.资源类型枚举.武器: break; case CardBasicInfo.资源类型枚举.奥秘: break; case CardBasicInfo.资源类型枚举.其他: break; default: break; } } }
public void Initialize() { deck = CardUtility.Shuffle(GameController.instance.testDeck); discardPile = new List <Card>(); hand = new List <Card>(); cardManager = new CardManager(deck, discardPile, hand, startingHandSize); UpdateAllDisplay(); }
private void TargetLoadHandCard(string hand, int index) { this.hand.Add(JsonUtility.FromJson <Card>(hand)); string cardString = CardUtility.CreateCardObjectName("GameCard", this.id, index); // Debug.Log("Looking for " + cardString); GameObject.Find(cardString).GetComponent <CardViewController>().Card = this.hand[index]; }
void Start() { cardDataBase = GameObject.FindObjectOfType <Sc_CardDataBase>(); battleManager = GameObject.FindObjectOfType <Sc_BattleManager>(); endPointDiscardX = GameObject.Find("DiscardPile").transform.position.x; endPointDiscardY = GameObject.Find("DiscardPile").transform.position.y; endPointY = -4.4f; Sc_BattleManager.currentHandObjects.Add(this.gameObject); // Add it to the array which holds all card objects placementInHand = Sc_BattleManager.currentHandObjects.Count; // Saves is place in the array // Vector3 newPosition = new Vector3 (1.1f * placementInHand, 2.2f, 0); // Just places it the right place // this.transform.position = newPosition; // Set the background of the card background = this.gameObject.transform.GetChild(0).gameObject; SpriteRenderer backgroundSR = background.GetComponent <SpriteRenderer>(); description = this.gameObject.transform.GetChild(1).gameObject; banner = this.gameObject.transform.GetChild(2).gameObject; leftIcon = this.gameObject.transform.GetChild(3).gameObject; rightIcon = this.gameObject.transform.GetChild(4).gameObject; leftBonusIconOne = this.gameObject.transform.GetChild(5).gameObject; leftBonusIconTwo = this.gameObject.transform.GetChild(6).gameObject; if (cardID < 1000) { SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetMeleeText(); } else if (cardID < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetArmorText(); } else if (cardID < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetUtilityText(); } else if (cardID < 4000) { CardCurse card = cardDataBase.FindCurseCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; } // Get other components }
/// <summary> /// 启动服务器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, EventArgs e) { CardUtility.Init(txtCardPath.Text); btnStartTcp.Enabled = false; btnStopTcp.Enabled = true; SystemManager.Init(); ServerThread = new Thread(TcpSocketServer.StartTcpServer); ServerThread.IsBackground = true; ServerThread.Start(); }
/// <summary> /// 洗牌 /// </summary> public void Suffle(int Seed) { var newList = CardUtility.RandomSort <String>(CardList.ToArray(), Seed); CardList.Clear(); foreach (var item in newList) { CardList.Push(item); } }
/// <summary> /// 对随从动作 /// </summary> /// <param name="game"></param> /// <param name="Minion"></param> /// <returns></returns> String IAtomicEffect.DealMinion(ActionStatus game, Card.MinionCard Minion) { var Summon = (Engine.Card.MinionCard)CardUtility.GetCardInfoBySN(变形目标卡牌编号); //一定要初始化,不然的话,生命值是0; Summon.初始化(); Summon.战场位置 = Minion.战场位置; //战场位置的继承 Minion = Summon; return(Server.ActionCode.strStatus + CardUtility.strSplitMark + Minion.战场位置.ToString() + CardUtility.strSplitMark + 变形目标卡牌编号); }
public void SetUtility() { hasSpecial = true; CardUtility card = cardDataBase.FindUtilityCardByID(id); backgroundSR.sprite = card.image; print(card.GetType().Name); if (card.GetType().Name == "SO_UtilityAp") { specialTitle.text = "AP Increase"; specialDescription.text = "This type of utility card, increases the amount of AP you have this turn"; } else if (card.GetType().Name == "SO_UtilityDamage") { specialTitle.text = "Damage"; specialDescription.text = "This type of utility card, deals damage to the monster when played"; } else if (card.GetType().Name == "SO_UtilityDeBuff") { specialTitle.text = "Debuff"; specialDescription.text = "This type of utility card, decreases the abilities of the monster"; } else if (card.GetType().Name == "SO_UtilityDoubleAttack") { specialTitle.text = "Double Attack"; specialDescription.text = "This type of utility card, makes you attack twice this turn"; } else if (card.GetType().Name == "SO_UtilityDraw") { specialTitle.text = "Draw"; specialDescription.text = "This type of utility card, draws extra cards, but you may have to dicard some"; } else if (card.GetType().Name == "SO_UtilityHealth") { specialTitle.text = "Health"; specialDescription.text = "This type of utility card, gives you back some of your banished card"; } else if (card.GetType().Name == "SO_UtilityPermaBuff") { specialTitle.text = "Perment Buff"; specialDescription.text = "This type of utility card, gives you buff which last until the of the battle"; } else if (card.GetType().Name == "SO_UtilityRage") { specialTitle.text = "Rage"; specialDescription.text = "For each weapon you have, add your rage bonus to your attacks"; } else if (card.GetType().Name == "SO_UtilityRecycle") { specialTitle.text = "Recycle"; specialDescription.text = "Allways you to take cards from your discard pile, back op to your hand"; } }
// cardInfo : [카드ID(8)][버스번호(7)][승차/하차 코드(1)][최근 승차시각(14)] // sample : CARD_001BUS_001N20171019143610 public void InspectCard(string startTime, string id, string busID, string cardInfo) { string strValidateCode; // cardInfo parsing //string cardID = cardInfo.Substring(0, 8); string cardBusID = cardInfo.Substring(8, 7); string code = cardInfo.Substring(15, 1); string rideTime = cardInfo.Substring(16); // Get Inspect Time string strInspectTime = DateTime.Now.ToString("yyyyMMddHHmmss"); // Validation // 1. Bus ID Match if (busID.Equals(cardBusID)) { // 2. Check Aboard Code if (code.Equals("N")) { // 3. Time Difference if (CardUtility.HourDiff(strInspectTime, rideTime) < 3) { strValidateCode = "R1"; } else { strValidateCode = "R4"; } } else { strValidateCode = "R3"; } } else { strValidateCode = "R2"; } // Create Folder string destFolder = "..\\..\\..\\" + id; System.IO.Directory.CreateDirectory(destFolder); // File Writing string strFilename = destFolder + "\\" + id + "_" + startTime + ".TXT"; string strWrite = id + "#" + busID + "#" + cardInfo + "#" + strValidateCode + "#" + strInspectTime + "\n"; FileStream fs = new System.IO.FileStream(strFilename, FileMode.Append); fs.Write(Encoding.UTF8.GetBytes(strWrite), 0, strWrite.Length); fs.Close(); }
public static string ToCardString(ulong bitCard) { string s = ""; var bcu = BitUtility.Instance; while (bitCard != 0) { int i = bcu.BitScanForward(bitCard); s += CardUtility.ToCardString(i) + ", "; bitCard ^= 1ul << i; } return(s.TrimEnd(new char[] { ',', ' ' })); }
public void AddUsedCards(List <CardData> cards) { cards.ForEach(c => { var bitCard = CardUtility.ToBitCard(c.Suit, c.Number); if ((BitUsedCard & bitCard) != 0) { throw new Exception("Duplication Error"); } BitUsedCard |= bitCard; }); }
public void Initialize() { List <Card> temp = new List <Card>(); temp.AddRange(GameController.instance.testSupply); temp.AddRange(GameController.instance.testSupply); temp.AddRange(GameController.instance.testSupply); temp.AddRange(GameController.instance.testSupply); temp.AddRange(GameController.instance.testSupply); deck = CardUtility.Shuffle(temp); discardPile = new List <Card>(); hand = new List <Card>(); cardManager = new CardManager(deck, discardPile, hand, startingHandSize); }
/// <summary> /// 开始一个动作 /// </summary> /// <param name="actionStatus"> /// 在调用这个过程之前,actionStatus里面的本方和对方都应该已经设定好了 /// 在这里不进行任何的方向判断,默认这个方法是由MyInfo发起的 /// </param> /// <param name="CardSn"></param> /// <returns></returns> public static List <string> StartAction(ActionStatus actionStatus, string CardSn) { //清除事件池,注意,事件将在动作结束后整体结算 actionStatus.battleEvenetHandler.事件池.Clear(); CardBasicInfo card = CardUtility.GetCardInfoBySN(CardSn); List <string> ActionCodeLst = new List <string>(); //未知的异常,卡牌资料缺失 if (card == null) { return(ActionCodeLst); } PublicInfo PlayInfo = actionStatus.AllRole.MyPublicInfo; switch (card.卡牌种类) { case CardBasicInfo.资源类型枚举.法术: actionStatus.ActionName = "USESPELLCARD"; UseSpellAction.RunBS(actionStatus, CardSn); break; case CardBasicInfo.资源类型枚举.随从: actionStatus.ActionName = "USEMINIONCARD"; UseMinionAction.RunBS(actionStatus, CardSn); break; case CardBasicInfo.资源类型枚举.武器: ActionCodeLst.Add(ActionCode.strWeapon + CardUtility.strSplitMark + CardSn); PlayInfo.Hero.Weapon = (WeaponCard)card; break; case CardBasicInfo.资源类型枚举.奥秘: ActionCodeLst.Add(ActionCode.strSecret + CardUtility.strSplitMark + CardSn); actionStatus.AllRole.MyPrivateInfo.奥秘列表.Add((SecretCard)card); PlayInfo.Hero.SecretCount = actionStatus.AllRole.MyPrivateInfo.奥秘列表.Count; break; default: break; } //随从卡牌的连击效果启动 Combo(actionStatus, card, ActionCodeLst, PlayInfo); if (ActionCodeLst.Count != 0) { PlayInfo.连击状态 = true; ActionCodeLst.AddRange(actionStatus.battleEvenetHandler.事件处理(actionStatus)); } return(ActionCodeLst); }
void IEffectHandler.DealMinion(Client.GameManager game, EffectDefine singleEffect, bool MeOrYou, int PosIndex) { var Summon = (Card.MinionCard)CardUtility.GetCardInfoBySN(singleEffect.AdditionInfo); //一定要初始化,不然的话,生命值是-1; Summon.Init(); if (MeOrYou) { game.MyInfo.BattleField.BattleMinions[PosIndex] = Summon; } else { game.YourInfo.BattleField.BattleMinions[PosIndex] = Summon; } }
public static bool isCollect(string id, string pwd) { if (m_log_info_dict.ContainsKey(id)) { string encPwd = m_log_info_dict[id]; string input_encPwd = CardUtility.passwordEncryption_SHA256(pwd); if (encPwd.Equals(input_encPwd)) { return(true); } } return(false); }
/// <summary> /// /// </summary> /// <param name="singleEffect"></param> /// <param name="game"></param> /// <param name="Pos"></param> /// <param name="Seed">随机数种子</param> /// <returns></returns> public static List<string> RunEffect(EffectDefine singleEffect, Client.GameManager game, CardUtility.TargetPosition Pos, int Seed) { List<String> PosList = Card.Effect.EffectDefine.GetTargetList(singleEffect, game, Pos, Seed); List<String> Result = new List<string>(); int HealthPoint = singleEffect.ActualEffectPoint; //处理对象 //ME#POS foreach (var PosInfo in PosList) { var PosField = PosInfo.Split(CardUtility.strSplitMark.ToCharArray()); if (PosField[0] == CardUtility.strMe) { if (PosField[1] == "0") { game.MySelf.RoleInfo.HealthPoint += HealthPoint; if (game.MySelf.RoleInfo.HealthPoint > 30) game.MySelf.RoleInfo.HealthPoint = 30; Result.Add(Card.Server.ActionCode.strHealth + Card.CardUtility.strSplitMark + PosInfo + Card.CardUtility.strSplitMark + game.MySelf.RoleInfo.HealthPoint.ToString()); } else { //位置从1开始,数组从0开始 game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint += HealthPoint; if (game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint > game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].StandardHealthPoint) game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint = game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].StandardHealthPoint; Result.Add(Card.Server.ActionCode.strHealth + Card.CardUtility.strSplitMark + PosInfo + Card.CardUtility.strSplitMark + game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint.ToString()); } } else { if (PosField[1] == "0") { game.YourInfo.HealthPoint += HealthPoint; if (game.YourInfo.HealthPoint > 30) game.YourInfo.HealthPoint = 30; Result.Add(Card.Server.ActionCode.strHealth + Card.CardUtility.strSplitMark + PosInfo + Card.CardUtility.strSplitMark + game.YourInfo.HealthPoint.ToString()); } else { //位置从1开始,数组从0开始 game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint += HealthPoint; if (game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint > game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].StandardHealthPoint) game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint = game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].StandardHealthPoint; Result.Add(Card.Server.ActionCode.strHealth + Card.CardUtility.strSplitMark + PosInfo + Card.CardUtility.strSplitMark + game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].ActualHealthPoint.ToString()); } } } return Result; }
/// <summary> /// /// </summary> /// <param name="singleEffect"></param> /// <param name="game"></param> /// <returns></returns> public static List<string> RunEffect(EffectDefine singleEffect, Client.GameManager game, CardUtility.TargetPosition Pos) { List<string> Result = new List<string>(); var Summon = (Card.MinionCard)CardUtility.GetCardInfoBySN(singleEffect.AddtionInfo); //一定要初始化,不然的话,生命值是-1; Summon.Init(); if (Pos.MeOrYou) { game.MySelf.RoleInfo.BattleField.BattleMinions[Pos.Postion - 1] = Summon; //TRANSFORM#ME#1#M9000001 Result.Add(ActionCode.strTransform + Card.CardUtility.strSplitMark + CardUtility.strMe + Card.CardUtility.strSplitMark + Pos.Postion + Card.CardUtility.strSplitMark + singleEffect.AddtionInfo); } else { game.YourInfo.BattleField.BattleMinions[Pos.Postion - 1] = Summon; Result.Add(ActionCode.strTransform + Card.CardUtility.strSplitMark + CardUtility.strYou + Card.CardUtility.strSplitMark + Pos.Postion + Card.CardUtility.strSplitMark + singleEffect.AddtionInfo); } return Result; }
/// <summary> /// /// </summary> /// <param name="singleEffect"></param> /// <param name="game"></param> /// <param name="Pos"></param> /// <param name="Seed">随机数种子</param> /// <returns></returns> public static List<string> RunEffect(EffectDefine singleEffect, Client.GameManager game, CardUtility.TargetPosition Pos, int Seed) { List<String> PosList = Card.Effect.EffectDefine.GetTargetList(singleEffect, game, Pos, Seed); List<String> Result = new List<string>(); int AttackPoint = singleEffect.ActualEffectPoint; //处理对象 //ME#POS foreach (var PosInfo in PosList) { var PosField = PosInfo.Split(CardUtility.strSplitMark.ToCharArray()); if (PosField[0] == CardUtility.strMe) { if (PosField[1] == "0") { switch (singleEffect.AddtionInfo) { case strFreeze: game.MySelf.RoleInfo.冰冻状态 = CardUtility.EffectTurn.效果命中; break; default: break; } } else { //位置从1开始,数组从0开始 switch (singleEffect.AddtionInfo) { case strFreeze: game.MySelf.RoleInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].冰冻状态 = CardUtility.EffectTurn.效果命中; break; default: break; } } } else { if (PosField[1] == "0") { switch (singleEffect.AddtionInfo) { case strFreeze: game.YourInfo.冰冻状态 = CardUtility.EffectTurn.效果命中; break; default: break; } } else { //位置从1开始,数组从0开始 switch (singleEffect.AddtionInfo) { case strFreeze: game.YourInfo.BattleField.BattleMinions[int.Parse(PosField[1]) - 1].冰冻状态 = CardUtility.EffectTurn.效果命中; break; default: break; } } } //STATUS#ME#1#FREEZE Result.Add(Card.Server.ActionCode.strStatus + Card.CardUtility.strSplitMark + PosInfo + Card.CardUtility.strSplitMark + strFreeze); } return Result; }
/// <summary> /// 触发事件 /// </summary> /// <param name="事件"></param> /// <param name="game"></param> /// <returns></returns> public List<String> 触发事件(CardUtility.全局事件 事件, GameManager game) { List<String> ActionLst = new List<string>(); for (int i = 0; i < BattleMinions.Length; i++) { var minion = BattleMinions[i]; if (minion != null) { ActionLst.AddRange(minion.触发事件(事件, game)); } } return ActionLst; }
/// <summary> /// /// </summary> /// <param name="singleEffect"></param> /// <param name="game"></param> /// <param name="Pos"></param> /// <param name="Seed"></param> /// <returns></returns> public static List<string> GetTargetList(EffectDefine singleEffect, Client.GameManager game, CardUtility.TargetPosition Pos, int Seed) { //切记,这里的EffectCount都是1 List<string> Result = new List<string>(); switch (singleEffect.EffictTargetSelectMode) { case CardUtility.TargetSelectModeEnum.随机: Random t = new Random(DateTime.Now.Millisecond + Seed); switch (singleEffect.EffectTargetSelectDirect) { case CardUtility.TargetSelectDirectEnum.本方: switch (singleEffect.EffectTargetSelectRole) { case CardUtility.TargetSelectRoleEnum.随从: Pos.Postion = t.Next(1, game.MySelf.RoleInfo.BattleField.MinionCount + 1); Pos.MeOrYou = true; break; case CardUtility.TargetSelectRoleEnum.所有角色: Pos.Postion = t.Next(0, game.MySelf.RoleInfo.BattleField.MinionCount + 1); Pos.MeOrYou = true; break; } //ME#POS Result.Add(CardUtility.strMe + CardUtility.strSplitMark + Pos.Postion.ToString("D1")); break; case CardUtility.TargetSelectDirectEnum.对方: switch (singleEffect.EffectTargetSelectRole) { case CardUtility.TargetSelectRoleEnum.随从: Pos.Postion = t.Next(1, game.YourInfo.BattleField.MinionCount + 1); Pos.MeOrYou = false; break; case CardUtility.TargetSelectRoleEnum.所有角色: Pos.Postion = t.Next(0, game.YourInfo.BattleField.MinionCount + 1); Pos.MeOrYou = false; break; } //ME#POS Result.Add(CardUtility.strYou + CardUtility.strSplitMark + Pos.Postion.ToString("D1")); break; case CardUtility.TargetSelectDirectEnum.双方: //本方对方 int MinionCount; if (t.Next(1, 3) == 1) { Pos.MeOrYou = true; MinionCount = game.MySelf.RoleInfo.BattleField.MinionCount; } else { Pos.MeOrYou = false; MinionCount = game.YourInfo.BattleField.MinionCount; } switch (singleEffect.EffectTargetSelectRole) { case CardUtility.TargetSelectRoleEnum.随从: Pos.Postion = t.Next(1, MinionCount + 1); break; case CardUtility.TargetSelectRoleEnum.所有角色: Pos.Postion = t.Next(0, MinionCount + 1); break; } //ME#POS Result.Add((Pos.MeOrYou ? CardUtility.strMe : CardUtility.strYou) + CardUtility.strSplitMark + Pos.Postion.ToString("D1")); break; default: break; } break; case CardUtility.TargetSelectModeEnum.全体: switch (singleEffect.EffectTargetSelectDirect) { case CardUtility.TargetSelectDirectEnum.本方: switch (singleEffect.EffectTargetSelectRole) { case CardUtility.TargetSelectRoleEnum.随从: for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")); } break; case CardUtility.TargetSelectRoleEnum.英雄: Result.Add(CardUtility.strMe + CardUtility.strSplitMark + 0.ToString("D1")); break; case CardUtility.TargetSelectRoleEnum.所有角色: Result.Add(CardUtility.strMe + CardUtility.strSplitMark + 0.ToString("D1")); for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")); } break; } break; case CardUtility.TargetSelectDirectEnum.对方: switch (singleEffect.EffectTargetSelectRole) { case CardUtility.TargetSelectRoleEnum.随从: for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")); } break; case CardUtility.TargetSelectRoleEnum.英雄: Result.Add(CardUtility.strYou + CardUtility.strSplitMark + 0.ToString("D1")); break; case CardUtility.TargetSelectRoleEnum.所有角色: Result.Add(CardUtility.strYou + CardUtility.strSplitMark + 0.ToString("D1")); for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")); } break; } break; case CardUtility.TargetSelectDirectEnum.双方: switch (singleEffect.EffectTargetSelectRole) { case CardUtility.TargetSelectRoleEnum.随从: for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")); } for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")); } break; case CardUtility.TargetSelectRoleEnum.英雄: Result.Add(CardUtility.strMe + CardUtility.strSplitMark + 0.ToString("D1")); Result.Add(CardUtility.strYou + CardUtility.strSplitMark + 0.ToString("D1")); break; case CardUtility.TargetSelectRoleEnum.所有角色: Result.Add(CardUtility.strMe + CardUtility.strSplitMark + 0.ToString("D1")); Result.Add(CardUtility.strYou + CardUtility.strSplitMark + 0.ToString("D1")); for (int i = 0; i < game.MySelf.RoleInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strMe + CardUtility.strSplitMark + (i + 1).ToString("D1")); } for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { Result.Add(CardUtility.strYou + CardUtility.strSplitMark + (i + 1).ToString("D1")); } break; } break; } break; case CardUtility.TargetSelectModeEnum.指定: Result.Add((Pos.MeOrYou ? CardUtility.strMe : CardUtility.strYou) + CardUtility.strSplitMark + Pos.Postion.ToString("D1")); break; case CardUtility.TargetSelectModeEnum.不用选择: if (singleEffect.EffectTargetSelectRole == CardUtility.TargetSelectRoleEnum.英雄){ switch (singleEffect.EffectTargetSelectDirect) { case CardUtility.TargetSelectDirectEnum.本方: Result.Add(CardUtility.strMe + CardUtility.strSplitMark + 0.ToString("D1")); break; case CardUtility.TargetSelectDirectEnum.对方: Result.Add(CardUtility.strYou + CardUtility.strSplitMark + 0.ToString("D1")); break; case CardUtility.TargetSelectDirectEnum.双方: Result.Add(CardUtility.strMe + CardUtility.strSplitMark + 0.ToString("D1")); Result.Add(CardUtility.strYou + CardUtility.strSplitMark + 0.ToString("D1")); break; default: break; } } break; } return Result; }