public override void Use(FighterData aFigher) { if (m_Type == ConsumableType.HEALTH) { aFigher.Heal(m_EffectAmount); } }
public void GenerateRandomCharacter() { if (GameData.instance.playerData.gold < model.rollCost) { Debug.LogError("Not enough gold."); return; } FighterData gachaCharacter = FighterGenerator.GenerateFighter(); bool isSuccessfullyAdded = GameData.instance.AddFighter(gachaCharacter); if (isSuccessfullyAdded) { // TODO: Build/Randomize sprite here, then save to playerData. view.DisplayGachaCharacter(gachaCharacter); GameData.instance.playerData.gold -= model.rollCost; app.view.headerView.UpdateGoldValue(); GameData.instance.playerData.Save(); CheckGold(); } else { //TODO Popup something here Debug.LogError("Failed to add, team already full!"); } }
private FighterData loadFighterData(string fighterDirectory) { FighterData data = null; data = JsonConvert.DeserializeObject <FighterData>(File.ReadAllText(Path.Combine(fighterDirectory, "fighter.json"))); return(data); }
public void Init(FighterData _data) { data = _data; lifeGauge.Init(data.maxLife, data.life); _data.skillList.CopyTo(data.skillList, 0); Debug.Log(data.skillList[0] + "," + data.skillList[1] + "," + data.skillList[2] + "," + data.skillList[3]); charaButton.GetComponent <Image>().sprite = GetFullSprite(); EventTrigger.Entry entry; EventTrigger charaButtonTrigger = charaButton.GetComponent <EventTrigger>(); entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; entry.callback.AddListener(SetAsTarget()); charaButtonTrigger.triggers.Add(entry); //離れたら消去 entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerExit; entry.callback.AddListener(( BaseEventData eventData) => { downChara = null; downskillID = -1; BattleManager.I.ExitSkillWindow(this, -1); } ); charaButtonTrigger.triggers.Add(entry); }
public static FighterData GenerateFighter() { FighterData newFighter = new FighterData(); newFighter.id = GUIDGenerator.NewGuid(); GachaDatabase gachaDatabase = GameDatabase.gachaDatabase; newFighter.name = gachaDatabase.GetRandomName (); // TODO: Implement readonly interface for data. ClassData classData = gachaDatabase.GetRandomClass (); newFighter.fighterClass = classData.fighterClass; newFighter.ATK = classData.baseATK; newFighter.HP = classData.baseHP; newFighter.fighterElement = gachaDatabase.GetRandomElement (); // TEMP. TODO: Must define isRanged in Data. if (newFighter.fighterClass == Class.Warrior) { newFighter.isRanged = false; } else { newFighter.isRanged = true; } RandomizeEquipment (newFighter); // RandomizeSkin (newFighter); return newFighter; }
public void InitItemUI(SimonInventoryManager.Item aItem, FighterData aFighter) { m_Icon.sprite = aItem.m_ItemData.Icon; m_TextName.text = aItem.m_ItemData.ItemName + " x" + aItem.m_Quantity; m_Item = aItem; m_User = aFighter; }
// TODO: Change to "RandomizeEquipment" (). // TODO: Add chance to accesssories/cape/wing. public static void RandomizeSkin(FighterData fighterData) { // If no sprites for this class exist, return. if (!GameDatabase.spriteDatabase.ContainsKey(fighterData.fighterClass)) { return; } // List of possible sprites for this class. SerializableDictionary <FighterSpriteAttachment.AttachmentType, List <string> > spritePool = GameDatabase.spriteDatabase [fighterData.fighterClass]; foreach (FighterSpriteAttachment.AttachmentType attachment in spritePool.Keys) { if (!spritePool.ContainsKey(attachment)) { continue; } List <string> attachmentPool = spritePool[attachment]; int randomAttachment = UnityEngine.Random.Range(0, attachmentPool.Count); fighterData.skinData.Add(attachment, attachmentPool[randomAttachment]); } }
public static void AddToParty(FighterData fighter, Party party) { // TODO: party capacity get. if ((party.currentCost + fighter.cost) < GameData.instance.playerData.partyCapacity) { party.Add (fighter); } }
//自身回合结束处理 private IEnumerator SelfBoutEndHandle() { FighterData boutEndFighterData = (FighterData)_battleModel.selfData.Clone(); Message.Send(MsgType.SELF_BOUT_END, boutEndFighterData); //虚无卡牌,在回合结束时消耗 var handListCopy = new List <CardInstance>(_battleModel.GetHandList()); foreach (var handCard in handListCopy) { CardTemplate cardTpl = CardTemplateData.GetData(handCard.tplId); if (cardTpl == null) { continue; } if (cardTpl.bEthereal) { _battleModel.ExhaustHandCard(handCard); } } //回合结束buff结算 SettleBuffOnBoutEnd(_battleModel.selfData); //手牌飞入弃牌堆 handListCopy = new List <CardInstance>(_battleModel.GetHandList()); foreach (var handCard in handListCopy) { _battleModel.MoveHandCardToUsed(handCard); } yield return(new WaitForSeconds(AnimationTime.HAND_TO_USED)); }
public void SetFighterDetails(FighterData fd) { ((FighterExpView)view).SetSprite(fd.skinData); ((FighterExpView)view).SetName(fd.name); ((FighterExpView)view).SetLevel(fd.level); ((FighterExpView)view).SetExpGained(100); ((FighterExpView)view).SetSliderValue(Random.value); }
public static void AddToParty(FighterData fighter, Party party) { // TODO: party capacity get. if ((party.currentCost + fighter.cost) < GameData.instance.playerData.partyCapacity) { party.Add(fighter); } }
public void SetTroopDetails(FighterData fighterData) { ((TroopDetailsView)view).SetName(fighterData.name); ((TroopDetailsView)view).SetAtk(fighterData.ATK); ((TroopDetailsView)view).SetHP(fighterData.HP); ((TroopDetailsView)view).SetCost(fighterData.cost); ((TroopDetailsView)view).SetSprite(fighterData.skinData); }
public void Remove(FighterData fighter) { if (fighters.Contains (fighter.id)) { fighters.Remove (fighter.id); currentCost -= fighter.cost; } }
public void SetTroopDetails(FighterData fighterData) { ((TroopDetailsView) view).SetName(fighterData.name); ((TroopDetailsView) view).SetAtk(fighterData.ATK); ((TroopDetailsView) view).SetHP(fighterData.HP); ((TroopDetailsView) view).SetCost(fighterData.cost); ((TroopDetailsView) view).SetSprite(fighterData.skinData); }
private void CreateFighterInfo(FighterData _fighter) { this.fighterInfoReference.gameObject.SetActive(true); FighterDeveloperInfo fighterDeveloperInfo = Object.Instantiate <FighterDeveloperInfo>(this.fighterInfoReference); fighterDeveloperInfo.transform.SetParent(this.fighterInfoReference.transform.parent, false); fighterDeveloperInfo.Initialize(_fighter, this); this.fighterInfoReference.gameObject.SetActive(false); }
public void Remove(FighterData fighter) { if (fighters.Contains(fighter.id)) { fighters.Remove(fighter.id); currentCost -= fighter.cost; } }
public void InitFirstFighter() { // Create default character FighterData fd = FighterGenerator.GenerateFighter(); AddFighter(fd); SetFighterOnActiveParty(fd, 0); playerData.Save(); }
public void LoadSpell(FighterData aFighter) { ClearContainer(); for (int i = 0; i < aFighter.Abilities.Count; i++) { CombatSpellUI spell = Instantiate(m_SpellUIPrefab, m_Container); spell.InitSpellUI(i, aFighter.Abilities[i], aFighter); } }
public void OverriderFigther(FighterData aNewFighter) { for (int i = 0; i < m_Fighters.Count; i++) { if (m_Fighters[i].Name.ToLower().Equals(aNewFighter.Name.ToLower())) { m_Fighters[i] = aNewFighter; return; } } }
public void Add(FighterData fighter) { Debug.Log ("ADDING..."); if (!fighters.Contains (fighter.id)) { fighters.Add (fighter.id); currentCost += fighter.cost; Debug.Log ("ADDED..."); } }
public void AddToParty(FighterData fighter) { if (currentParty == null) { currentParty = new Party(); } PartyManager.AddToParty(fighter, currentParty); Save(); }
public void Add(FighterData fighter) { Debug.Log("ADDING..."); if (!fighters.Contains(fighter.id)) { fighters.Add(fighter.id); currentCost += fighter.cost; Debug.Log("ADDED..."); } }
private void OnClosedCustomizationWindow() { if (this.fighterDeveloperWindow.gameObject.activeInHierarchy) { FighterData myFighterData = this.fighterDeveloperWindow.MyFighterData; this.fighterDeveloperWindow.Close(); this.fighterDeveloperWindow.Open(myFighterData, this); } this.RefreshFightersInfos(); this.m_customizationWindow.OnClose -= this.OnClosedCustomizationWindow; this.m_customizationWindow.transform.root.gameObject.SetActive(false); }
public bool CheckIfFighterActive(FighterData fd) { // for(int i = 0; i < activeParty.Length; i++) // { // if(activeParty[i] != null && activeParty[i].id == fd.id) // { // return true; // } // } return(false); }
// Return true if fighter successfully added to team, else return false public bool AddFighter(FighterData fighter) { if (playerData.fightersOwned.Count >= GetFighterCapacity()) { return(false); } playerData.fightersOwned.Add(fighter.id, fighter); // playerData.Save (); return(true); }
public bool CheckIfFighterActive(FighterData fd) { // for(int i = 0; i < activeParty.Length; i++) // { // if(activeParty[i] != null && activeParty[i].id == fd.id) // { // return true; // } // } return false; }
// Return true if fighter successfully added to team, else return false public bool AddFighter(FighterData fighter) { if(playerData.fightersOwned.Count >= GetFighterCapacity()) { return false; } playerData.fightersOwned.Add(fighter.id, fighter); // playerData.Save (); return true; }
public bool IsTroopActive(FighterData fd) { for (int i = 0; i < model.activeTroops.Count; i++) { if (model.activeTroops[i] != null && model.activeTroops[i].id == fd.id) { return(true); } } return(false); }
/// <summary> /// loads just the fighter.json from all fighters /// </summary> public Dictionary <string, FighterData> LoadAllFighters() { FileSystemHelper fileSystem = DataController.FileSystem; List <string> fighterDirs = fileSystem.getAllFighterDirectories(); foreach (string fighterDir in fighterDirs) { string name = fileSystem.getFighterNameFromDirectoryPath(fighterDir); FighterData data = loadFighterData(fighterDir); database.Add(name, data); } }
public void UpdateFighterData(string aName, int aHealth) { for (int i = 0; i < m_Fighters.Count; i++) { if (m_Fighters[i].Name.ToLower().Equals(aName.ToLower())) { FighterData aFighter = m_Fighters[i]; aFighter.UpdateData(aHealth); m_Fighters[i] = aFighter; return; } } }
public void UpdateValues() { FighterData fighterData = (model as BattleMenuItemModel).fighter.GetComponent <FighterModel> ().fighterData; fighterName.text = fighterData.name; int currentHP = fighterData.HP; int maxHP = fighterData.maxHP; float hpFill = (float)currentHP / (float)maxHP; // TODO: Animate.. Gradually decrease fill amount. hpSlider.fillAmount = hpFill; }
public void AddTroopOnTeam(FighterData troop) { if (!model.activeTroops.Contains(troop)) { model.activeTroops.Add(troop); // new. TODO: cleanup, migrate/deprecate old code. gameData.playerData.AddToParty(troop); Debug.Log("ADD: " + gameData.playerData.currentParty.currentCost + " / " + gameData.playerData.partyCapacity); } view.SetCost(gameData.playerData.currentParty.currentCost, gameData.playerData.partyCapacity); }
public void RemoveTroopOnTeam(FighterData fd) { for (int i = 0; i < model.activeTroops.Count; i++) { if (model.activeTroops[i] != null && model.activeTroops[i].id == fd.id) { model.activeTroops[i] = null; break; } } gameData.playerData.currentParty.fighters.Remove(fd.id); view.SetCost(gameData.playerData.currentParty.currentCost, gameData.playerData.partyCapacity); }
private void SetupNewBattle(AdventurerAgent agent, FighterObject enemyFighter) { if (battleSystems.ContainsKey(agent)) { battleSystems.Remove(agent); } var playerData = agent.GetComponent <AdventurerFighterData>().FighterData; var enemyData = FighterData.Clone(enemyFighter.data); var newSystem = new BattleSubSystem(playerData, enemyData, enemyFighter.fighterDropTable, OnWin); battleSystems.Add(agent, newSystem); SetAdventureState(agent, AdventureStates.InBattle); }
public override void OnCharBoutEnd(object obj) { FighterData charData = obj as FighterData; if (0 == charData.armor) { //获得护甲 BattleModel battleModel = BattleModel.Inst; RelicTemplate relicTplt = RelicTemplateData.GetData(this.tplId); if (relicTplt != null) { battleModel.AddArmor(battleModel.selfData, relicTplt.nVal); } } return; }
//获取卡牌描述 private string GetCardDesc(string orignDesc) { //处理攻击 FighterData selfData = BattleModel.Inst.selfData; foreach (Match match in Regex.Matches(orignDesc, PAT_ATTACK)) { int damage; int.TryParse(Regex.Match(match.Value, @"\d+").Value, out damage); int newDamage = BattleTool.AdjustAttackVal(selfData, null, damage); string colorDamage = newDamage.ToString(); if (newDamage > damage) { colorDamage = TextTool.FormatUBBColor(colorDamage, "#00FF00"); } else if (newDamage < damage) { colorDamage = TextTool.FormatUBBColor(colorDamage, "#FF0000"); } orignDesc = orignDesc.Replace(match.Value, string.Format(GameText.CARD_DAMAGE, colorDamage)); } //处理防御 foreach (Match match in Regex.Matches(orignDesc, PAT_DEFENCE)) { int defence; int.TryParse(Regex.Match(match.Value, @"\d+").Value, out defence); int newDefence = BattleTool.AdjustArmorVal(selfData, defence); string colorDefence = newDefence.ToString(); if (newDefence > defence) { colorDefence = TextTool.FormatUBBColor(colorDefence, "#00FF00"); } else if (newDefence < defence) { colorDefence = TextTool.FormatUBBColor(colorDefence, "#FF0000"); } orignDesc = orignDesc.Replace(match.Value, string.Format(GameText.CARD_DEFENCE, colorDefence)); } return(orignDesc); }
public void AddFighter(FighterTypes _fighter, ref GameData _gameData) { int num = 0; int[] buildingLevels = _gameData.GetBuildingLevels("GladiatorResidence"); if (buildingLevels != null && buildingLevels.Length > 0) { num = buildingLevels[0]; } int num2 = this.gladiatorResidence.maxGladiatorsAllowed[num - 1]; if (num2 > _gameData.fighters.Count) { int powerOrMetaLevel = 100; FighterData fighterData = FighterManager.Instance.GenerateAIFighterData(_fighter, 0, powerOrMetaLevel, false, 1f, null, false, 0, null); fighterData.lvlData.lvl = 0; fighterData.lvlData.rank = 0; fighterData.lvlData.metaLvl = 0; fighterData.initialRank = 0; if (_gameData == GameFSM.gameData) { FighterManager.GladiatorClass fighterClass = FighterManager.Instance.GetFighterClass(fighterData.type); fighterData.visualPrefab = this.visualAspects.options[this.visualAspects.value].text; FighterManager.CharacterInfo characterInfo = fighterClass.GetCharacterInfo(fighterData.visualPrefab); fighterData.combatPrefab = characterInfo.combatPrefab; fighterData.cityPrefab = characterInfo.cityPrefab; fighterData.rarity = (Rarity)this.rarityDropdown.value; EventTracker.Instance.AnalyticsData.RegisterFighterLevelUpDate(fighterData); this.CreateFighterInfo(fighterData); } FighterManager.UnlockInfo.UnlockEntry[] unlocks = FighterManager.Instance.GetUnlocks(fighterData.initialRank, 0, false); if (unlocks != null && unlocks.Length > 0) { foreach (FighterManager.UnlockInfo.UnlockEntry unlockEntry in unlocks) { fighterData.AddOrUpgradeUnlock(unlockEntry.unlockType, unlockEntry.value); } } _gameData.AddFighter(fighterData); this.fighterDeveloperWindow.FillSkills(fighterData, false); } }
static void RandomizeEquipment(FighterData fighterData) { ClassData classData = GameDatabase.classDatabase [fighterData.fighterClass]; foreach (Equipment.Type equipmentType in classData.equipmentAllowed) { // TODO: Equip gacha categories. Required/Not required e.g. Sword/armor vs accessories/wings/cape. // TODO: Equip drop rate. List<Equipment> equipmentPool = GameDatabase.equipmentDatabase.GetItems (equipmentType, false); if (equipmentPool != null) { Equipment randomEquipment = equipmentPool[UnityEngine.Random.Range (0, equipmentPool.Count)]; fighterData.equipmentData.Add (equipmentType, randomEquipment); // TEMP. add attachment type member to Equipment? FighterSpriteAttachment.AttachmentType attachmentType = (FighterSpriteAttachment.AttachmentType) Enum.Parse(typeof(FighterSpriteAttachment.AttachmentType), equipmentType.GetType ().Name); //randomEquipment.type.typeName); fighterData.skinData.Add (attachmentType, randomEquipment.spriteName); } } }
// TODO: Change to "RandomizeEquipment" (). // TODO: Add chance to accesssories/cape/wing. public static void RandomizeSkin(FighterData fighterData) { // If no sprites for this class exist, return. if (!GameDatabase.spriteDatabase.ContainsKey (fighterData.fighterClass)) { return; } // List of possible sprites for this class. SerializableDictionary<FighterSpriteAttachment.AttachmentType, List<string>> spritePool = GameDatabase.spriteDatabase [fighterData.fighterClass]; foreach (FighterSpriteAttachment.AttachmentType attachment in spritePool.Keys) { if (!spritePool.ContainsKey (attachment)) { continue; } List<string> attachmentPool = spritePool[attachment]; int randomAttachment = UnityEngine.Random.Range (0, attachmentPool.Count); fighterData.skinData.Add (attachment, attachmentPool[randomAttachment]); } }
public void DisplayGachaCharacter(FighterData fData) { nameLabel.text = "Name: " + fData.name; hpLabel.text = "HP: " + fData.HP; atkLabel.text = "ATK: " + fData.ATK; classLabel.text = "Class: " + fData.fighterClass; elementLabel.text = "Element: " + fData.fighterElement; classIcon.texture = Resources.Load("Sprites/ClassIcons/" + fData.fighterClass) as Texture; classIcon.gameObject.SetActive(true); for (int i = 0; i < gachaSprites.Count; i++) { if(gachaSprites[i].characterClass == fData.fighterClass) { gachaSprites[i].characterSprite.SetActive(true); gachaSprites[i].characterSprite.GetComponent<FighterSpriteController>().SetFighterSkin (fData.skinData); } else { gachaSprites[i].characterSprite.SetActive(false); } } }
public void RemoveFromParty(FighterData fighter) { PartyManager.RemoveFromParty (fighter, currentParty); Save (); }
public void AddToParty(FighterData fighter) { if (currentParty == null) { currentParty = new Party (); } PartyManager.AddToParty (fighter, currentParty); Save (); }
public static void RemoveFromParty(FighterData fighter, Party party) { party.Remove (fighter); }
public void SetFighterOnActiveParty(FighterData fighter, int indexOnParty) { // if(indexOnParty > -1 && indexOnParty < playerData.activePartyIDs.Length) // { // if(fighter == null) // { // activeParty[indexOnParty] = null; // playerData.activePartyIDs[indexOnParty] = ""; // } // else // { // activeParty[indexOnParty] = fighter; // playerData.activePartyIDs[indexOnParty] = fighter.id; // //Debug.Log("Added fighter " + playerData.activePartyIDs[indexOnParty] + " to party"); // } // } // else // { // Debug.LogError("Index out of bounds, failed to set fighter on party"); // } }