public void TargetReport(string Targetguid) { if (controllerState != ControllerState.targeting) { return; } var ent = EntityManager.Singelton.GetEntity(targetingEntity);// as Card; if (ent == null) { return; } if (targetOptions != null) { for (int i = 0; i < targetOptions.Count; i++) { if (targetOptions[i].GetType() == typeof(PlayCardOption)) { PlayCardOption pco = targetOptions[i] as PlayCardOption; if (pco.targetGuid == Targetguid) { OptionsManager.Singleton.PickUpOption(pco); targetOptions = null; return; } } } } //will not work spells, or hero powers that require targets--how do, pls help if (OptionsManager.Singleton.options.ContainsKey(Targetguid)) { var options = OptionsManager.Singleton.options[Targetguid]; foreach (Option op in options) { if (op.GetType() == typeof(AttackOption)) { var opA = op as AttackOption; if (opA.defenderGuid == Targetguid) { OptionsManager.Singleton.PickUpOption(opA); controllerState = ControllerState.waiting; targetingEntity = null; if (ent.GetType() == typeof(Card)) { Card card = ent as Card; card.GetCardAvatar().cardAvatarState = CardAvatarState.inPlay; } else if (ent.GetType() == typeof(Hero)) { } } } } } }
public void OnHeroPortaitClicked(HeroAvatar heroAvatar) { if (targetOptions != null) { for (int i = 0; i < targetOptions.Count; i++) { if (targetOptions[i].GetType() == typeof(PlayCardOption)) { PlayCardOption pco = targetOptions[i] as PlayCardOption; if (pco.targetGuid == heroAvatar.careAboutGuid) { OptionsManager.Singleton.PickUpOption(pco); targetOptions = null; return; } } } } }
public void StartToProcessOptions(JSONObject jsonObject) { int count = 0; foreach (JSONObject j in jsonObject["options"].list) { switch (j["option_type"].str) { case MULLIGAN: //WHY DID I DO THIS /* * Mulligan m = new Mulligan(); * m.n = count; * // m.cardGuid = j["cardGuid"].str; * count++; * if(!options.ContainsKey(m.cardGuid)) * { * options.Add(m.cardGuid, new List<Option>()); * } * * options[m.cardGuid].Add(m); * */ break; case NO_MULLIGAN: NoMulligan nm = new NoMulligan(); nm.n = count; count++; if (!options.ContainsKey(noMulliganKey)) { options.Add(noMulliganKey, new List <Option>()); } options[noMulliganKey].Add(nm); break; case END_TURN: EndTurn et = new EndTurn(); et.n = count; count++; if (!options.ContainsKey(END_TURN)) { options.Add(END_TURN, new List <Option>()); } options[END_TURN].Add(et); break; case PLAY_CARD: PlayCardOption pc = new PlayCardOption(); pc.n = count; pc.cardGuid = j["source_uid"].n.ToString(); pc.targetGuid = j["target_uid"].n.ToString(); count++; if (!options.ContainsKey(pc.cardGuid)) { options.Add(pc.cardGuid, new List <Option>()); } options[pc.cardGuid].Add(pc); break; case ATTACK: AttackOption a = new AttackOption(); a.n = count; a.cardGuid = j ["source_uid"].n.ToString(); a.defenderGuid = j["target_uid"].n.ToString(); count++; if (!options.ContainsKey(a.cardGuid)) { options.Add(a.cardGuid, new List <Option>()); } options[a.cardGuid].Add(a); break; case HERO_POWER: break; case PLAY_SPELL: PlaySpellOption ps = new PlaySpellOption(); ps.n = count; ps.cardGuid = j["cardGuid"].n.ToString(); ps.target = j["targetGuid"].n.ToString(); count++; if (!options.ContainsKey(ps.cardGuid)) { options.Add(ps.cardGuid, new List <Option>()); } options[ps.cardGuid].Add(ps); break; default: break; } } }