// Sets the new state for the variables for Battle private void BattleEngineInit() { CharacterList.Clear(); // Clear the rest of the data BattleEngineClearData(); }
// Add Characters // Scale them to meet Character Strength... public bool AddCharactersToBattle() { // Check to see if the Character list is full, if so, no need to add more... if (CharacterList.Count >= 6) { return(true); } // TODO, determine the character strength // add Characters up to that strength... var ScaleLevelMax = 2; var ScaleLevelMin = 1; if (CharactersViewModel.Instance.Dataset.Count < 1) { return(false); } // Get 6 Characters do { var myData = GetRandomCharacter(ScaleLevelMin, ScaleLevelMax); CharacterList.Add(myData); } while (CharacterList.Count < 6); return(true); }
// Add Characters // Scale them to meet Character Strength... public bool AddCharactersToBattle() { // Check if the Character list is empty if (CharactersViewModel.Instance.Dataset.Count < 1) { return(false); } // Check if the Character list has enough characters if (CharacterList.Count >= 6) { return(true); } // If the party does not have 6 characters, add them. var ScaleLevelMax = 3; var ScaleLevelMin = 1; // Get up to 6 Characters do { var Data = GetRandomCharacter(ScaleLevelMin, ScaleLevelMax); CharacterList.Add(Data); } while (CharacterList.Count < GameGlobals.MaxNumberPartyPlayers); return(true); }
/// <summary> /// Have the damage taken be reflected in the Character or Monster List /// </summary> /// <param name="Target"></param> /// <param name="damage"></param> /// <returns></returns> public bool TakeDamage(BattleEntityModel Target, int damage) { if (Target == null) { return(false); } Target.TakeDamage(damage); switch (Target.EntityType) { case (EntityTypeEnum.Character): var character = CharacterList.First(a => a.Id == Target.Id); character.TakeDamage(damage); // Hackathon scenario 9 - Miracle Max if (!character.Alive && character.MiracleMax) { EntityList.First(a => a.Id == Target.Id).CurrentHealth = character.MaxHealth; // it's a miracle! character.CurrentHealth = character.MaxHealth; character.MiracleMax = false; EntityList.First(a => a.Id == Target.Id).Alive = true; EntityList.First(a => a.Id == Target.Id).CurrentHealth = character.MaxHealth; character.Alive = true; BattleMessages.TurnMessageSpecial = character.Name + " has been miraculously revived by Miracle Max!\nSee Miracle Max for all of your miraculous needs~"; Debug.WriteLine(BattleMessages.TurnMessageSpecial); } return(true); case (EntityTypeEnum.Monster): default: MonsterList.First(a => a.Id == Target.Id).TakeDamage(damage); return(true); } }
public MainWindow() { InitializeComponent(); characterList = new CharacterList(); monsterList = new MonsterList(); encounterList = new EncounterList(); }
public ActionResult AllCharacters() { //ViewBag.Message = "All of the characters made by the program!"; CharacterList model = service.GetAllCharacters(); return(View(model)); }
protected virtual void RealmSocket_OnCharacterList(CharacterList Packet) { int arg_0D_0 = 0; checked { int num = (int)(unchecked ((ulong)Packet.Listed) - 1uL); for (int i = arg_0D_0; i <= num; i++) { if (this.Infos.CharName == null) { this.Infos.CharName = ""; } if (Operators.CompareString(this.Infos.CharName, "", false) == 0 | Operators.CompareString(Packet.Characters[i].Name.ToLower(), this.Infos.CharName.ToLower(), false) == 0) { CharacterLogonRequest packet = new CharacterLogonRequest(Packet.Characters[i].Name); this.Realm.SendPacket(packet); this.Hero.Name = Packet.Characters[i].Name; this.Hero.Class = Packet.Characters[i].Class; this.Hero.Level = Packet.Characters[i].Level; this.Realm.WriteToLog("Login with Char: " + this.Hero.Name, Color.Orange); return; } } this.Realm.WriteToLog("Character not found, idling", Color.Orange); } }
public void LoadCharacterDataTest() { load = new LoadCharacters(); characterList = load.LoadCharacterData("testData.json"); Assert.That("Ned Stark" == characterList.character[0]); }
// Start is called before the first frame update void Start() { CharacterList instance = CharacterList.GetInstance(); instance.list.Add(character); Debug.Log(character.spell1); }
void Update() { if (initializationPending) { // Loading the datasets characters = syncManager.OpenOrCreateDataset("characters"); // when ds.Synchronize() is called the localDataset is merged with the remoteDataset // OnDatasetDeleted, OnDatasetMerged, OnDatasetSuccess, the corresponding callback is fired. // The developer has the freedom of handling these events needed for the Dataset characters.OnSyncSuccess += this.HandleSyncSuccess; // OnSyncSucess uses events/delegates pattern characters.OnSyncFailure += this.HandleSyncFailure; // OnSyncFailure uses events/delegates pattern characters.OnSyncConflict = this.HandleSyncConflict; characters.OnDatasetMerged = this.HandleDatasetMerged; characters.OnDatasetDeleted = this.HandleDatasetDeleted; LoadFromDataset(); initializationPending = false; } if (characterStrings != null) { CharacterList charList = GetComponent <CharacterList> (); charList.DeserializeCharacters(characterStrings); characterStrings = null; charList.enabled = true; } }
/// <summary> /// Target Died /// /// Process for death... /// /// Returns the count of items dropped at death /// </summary> /// <param name="Target"></param> public bool TargedDied(PlayerInfoModel Target) { // Mark Status in output BattleMessagesModel.TurnMessageSpecial = " and causes death. "; // Remove target from list... // Using a switch so in the future additional PlayerTypes can be added (Boss...) switch (Target.PlayerType) { case PlayerTypeEnum.Character: CharacterList.Remove(Target); // Add the MonsterModel to the killed list BattleScore.CharacterAtDeathList += Target.FormatOutput() + "\n"; DropItems(Target); return(true); case PlayerTypeEnum.Monster: default: MonsterList.Remove(Target); // Add one to the monsters killed count... BattleScore.MonsterSlainNumber++; // Add the MonsterModel to the killed list BattleScore.MonstersKilledList += Target.FormatOutput() + "\n"; DropItems(Target); return(true); } }
public void SaveLoadMaintainsEquipmentBonusesForNonPartyMemberCastedBuffs() { Party party = new Party(); Character dummy = CharacterList.TestEnemy(); Character buffCaster = CharacterList.TestEnemy(); buffCaster.Inventory.ForceAdd(new BrokenSword()); buffCaster.Equipment.AddEquip(buffCaster.Inventory, new BuffParams(buffCaster.Stats, buffCaster.Id), new BrokenSword()); Character buffRecipient = CharacterList.TestEnemy(); StrengthScalingPoison poison = new StrengthScalingPoison(); Debug.Log("BuffcasterID: " + buffCaster.Id); poison.Caster = new BuffParams(buffCaster.Stats, buffCaster.Id); buffRecipient.Buffs.AddBuff(poison); party.AddMember(dummy); party.AddMember(CharacterList.TestEnemy()); party.AddMember(buffRecipient); PartySave retrieved = FromJson <PartySave>(ToJson(party.GetSaveObject())); Party party2 = new Party(); party2.InitFromSaveObject(retrieved); int spoofedStrength = party2.Collection.ToArray()[2].Buffs.ToArray()[0].BuffCaster.GetEquipmentBonus(StatType.STRENGTH); Assert.AreEqual(spoofedStrength, (new BrokenSword()).Stats[StatType.STRENGTH]); Debug.Log("" + spoofedStrength); }
/// <summary> /// Add Monsters to the Round /// /// Because Monsters can be duplicated, will add 1, 2, 3 to their name /// /* * Hint: * I don't have crudi monsters yet so will add 6 new ones... * If you have crudi monsters, then pick from the list * Consdier how you will scale the monsters up to be appropriate for the characters to fight * */ /// </summary> /// <returns></returns> public int AddMonstersToRound() { var monsterModel = MonsterIndexViewModel.Instance; Random rnd = new Random(); int TargetLevel = 1; int MaxLevel = 20; if (CharacterList.Count() > 0) { // Get the Min Character Level (linq is soo cool....) TargetLevel = Convert.ToInt32(CharacterList.Min(m => m.Level)); MaxLevel = Convert.ToInt32(CharacterList.Max(m => m.Level)); } /* Hack 31 has been implemented. If the round count is > 100 * then the monster's speed, defense, attack, current health, and max health * are buffed 10x */ for (var i = 0; i < MaxNumberPartyMonsters; i++) { int index = rnd.Next(0, MaxNumberPartyMonsters - 1); var data = monsterModel.Dataset[index]; data.Level = TargetLevel; data.Speed = getAttributeLevel(); data.Defense = getAttributeLevel(); data.Attack = getAttributeLevel(); data.MaxHealth = DiceHelper.RollDice(TargetLevel, 10); data.CurrentHealth = data.MaxHealth; MonsterList.Add(new PlayerInfoModel(data)); } return(MonsterList.Count()); }
public Game(string name) { Name = name; Worldspace = Worldspace.Instance; FactionList = new FactionList(); CharacterList = new CharacterList(); }
public bool Deserialize(ref CharacterList element) { if (GetDataSize() == 0) { // 데이터가 설정되지 않았다. return false; } bool ret = true; byte nameLength = 0; string name; byte gender = 0; byte hClass = 0; byte level = 0; for (int i = 0; i < element.CharacterData.Length; i++) { ret &= Deserialize(ref nameLength); ret &= Deserialize(out name, nameLength); ret &= Deserialize(ref gender); ret &= Deserialize(ref hClass); ret &= Deserialize(ref level); element.CharacterData[i] = new CharacterData(name, gender, hClass, level); } return ret; }
protected override void HandleAppPacket(AppPacket packet) { switch ((WorldOp)packet.Opcode) { case WorldOp.GuildsList: break; case WorldOp.LogServer: case WorldOp.ApproveWorld: case WorldOp.EnterWorld: case WorldOp.ExpansionInfo: break; case WorldOp.SendCharInfo: var chars = new CharacterSelect(packet.Data); CharacterList?.Invoke(this, chars.Characters); break; case WorldOp.MessageOfTheDay: MOTD?.Invoke(this, Encoding.ASCII.GetString(packet.Data)); break; case WorldOp.ZoneServerInfo: var info = packet.Get <ZoneServerInfo>(); ZoneServer?.Invoke(this, info); break; default: WriteLine($"Unhandled packet in WorldStream: {(WorldOp)packet.Opcode} (0x{packet.Opcode:X04})"); Hexdump(packet.Data); break; } }
public static CharacterList getCharacterList(int page = 1) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("https://gateway.marvel.com"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string lien = "/v1/public/characters?ts=1&apikey=81ca23b977c4b9d1f55715b9f4b16b50&hash=36261a4a1ba872396797b75452408068&offset=" + (page - 1) * 20; HttpResponseMessage reponse = client.GetAsync(lien).Result; CharacterDataWrapper e = new CharacterDataWrapper(); if (reponse.IsSuccessStatusCode) { string contenu = reponse.Content.ReadAsStringAsync().Result; e = JsonConvert.DeserializeObject <CharacterDataWrapper>(contenu); } CharacterList retour = new CharacterList(); foreach (Character element in e.data.results) { retour.items.Add(element); } return(retour); }
public void Setup(string sessionKey, string accountname, string password, string authToken, CharacterList characterList) { m_SessionKey = sessionKey; m_AccountName = accountname; m_Password = password; m_AuthenticatorToken = authToken; m_CharacterList = characterList; m_CharacterIndex = 0; var content = m_ScrollRect.content; foreach (Transform child in content) { Destroy(child.gameObject); } int i = 0; bool reversed = characterList.Characters.Count % 2 == 0; foreach (var character in characterList.Characters) { var characterPanel = Instantiate(OpenTibiaUnity.GameManager.CharacterPanelPrefab); characterPanel.transform.SetParent(content); characterPanel.characterName.text = character.Name; characterPanel.worldName.text = characterList.FindWorld(character.World).Name; characterPanel.ColorSwitched = reversed ? (i++ % 2 == 0) : (++i % 2 == 0); characterPanel.onDoubleClick.AddListener(SubmitEnterGame); } }
public void SaveLoadDoesNotMaintainsReferencesForNonPartyMemberCastedBuffs() { Party party = new Party(); Character dummy = CharacterList.TestEnemy(); Character buffCaster = CharacterList.TestEnemy(); Character buffRecipient = CharacterList.TestEnemy(); Poison poison = new Poison(); Debug.Log("BuffcasterID: " + buffCaster.Id); poison.Caster = new BuffParams(buffCaster.Stats, buffCaster.Id); buffRecipient.Buffs.AddBuff(poison); party.AddMember(dummy); party.AddMember(CharacterList.TestEnemy()); party.AddMember(buffRecipient); PartySave retrieved = FromJson <PartySave>(ToJson(party.GetSaveObject())); Party party2 = new Party(); party2.InitFromSaveObject(retrieved); List <Character> a = party.ToList(); List <Character> b = party.ToList(); Character caster = b[1]; Character target = b[2]; Assert.IsTrue(party.Equals(party2)); Assert.AreEqual(party, party2); Assert.AreNotSame(party.Collection.ToList()[1].Stats, party.Collection.ToList()[2].Buffs.ToList()[0].BuffCaster); }
public void SaveLoadMaintainsBonusesFromEquipmentAndBuffsForPartyMemberCastedBuffs() { Party party = new Party(); Character dummy = CharacterList.TestEnemy(); Character buffCaster = CharacterList.TestEnemy(); buffCaster.Inventory.ForceAdd(new BrokenSword()); buffCaster.Equipment.AddEquip(buffCaster.Inventory, new BuffParams(buffCaster.Stats, buffCaster.Id), new BrokenSword()); buffCaster.AddBuff(new StrengthBoost()); Character buffRecipient = CharacterList.TestEnemy(); StrengthScalingPoison poison = new StrengthScalingPoison(); Debug.Log("BuffcasterID: " + buffCaster.Id); poison.Caster = new BuffParams(buffCaster.Stats, buffCaster.Id); buffRecipient.Buffs.AddBuff(poison); party.AddMember(dummy); party.AddMember(CharacterList.TestEnemy()); party.AddMember(buffRecipient); party.AddMember(buffCaster); PartySave retrieved = FromJson <PartySave>(ToJson(party.GetSaveObject())); Party party2 = new Party(); party2.InitFromSaveObject(retrieved); Assert.AreEqual(buffCaster.Stats, party2.Collection.ToArray()[3].Stats); Assert.AreEqual(buffCaster.Buffs, party2.Collection.ToArray()[3].Buffs); }
public void Find() { int offset = 0; if (null != SelectedCharacter) { offset = CharacterList.IndexOf(SelectedCharacter); ++offset; } // return the first character found by comparing name (index = {offset ~ max}) for (int i = offset; i < CharacterList.Count; ++i) { if (NameToFind.Equals(CharacterList[i].Name)) { SelectedCharacter = CharacterList[i]; return; // found } } // not found string msg = string.Format(Properties.Resources.ErrCharacterNotFound, NameToFind); Log.Error(Properties.Resources.ErrMsgBoxTitle, msg); }
public void SaveOrUpdateAction() { if (IsNotExist()) { character = new Character(); character.ID = this.textBoxID.Text; character.Link = this.textBoxLink.Text; try { CharacterList.InsertCharacter(character); this.Close(); } catch { MessageBox.Show("Thêm mới character " + character.ID + " không thành công."); } } else { character.Link = this.textBoxLink.Text; try { CharacterList.UpdateCharacter(character); this.Close(); } catch { MessageBox.Show("Cập nhật character " + character.ID + " không thành công."); } } }
/// <summary> /// 當產生時初始化相關資訊 /// </summary> /// <param name="spawnCharacter">產生者</param> public void OnSpawnObjcet(SpawnCharacter spawnCharacter) { m_spawner = spawnCharacter; m_currTarget = m_spawner.m_target; m_enemys = m_spawner.m_characsList; StartCoroutine(AI()); }
public void Save() { if (false == CharViewModel.IsValid()) { return; } if (null == SelectedCharacter) { // add if (false == canAdd()) { return; } Character c = new Character(CharViewModel.Name); CharacterList.Add(c); CharViewModel.Init(); } else { // edit // @note : Character Input Format 변경될 때마다 반영되어야 한다. (save) SelectedCharacter.Name = CharViewModel.Name; } }
// Add Characters // Scale them to meet Character Strength... public bool AddCharactersToBattle() { // Check if the Character list is empty if (CharactersViewModel.Instance.Dataset.Count < 1) { return(false); } // Check to see if the Character list is full, if so, no need to add more... if (CharacterList.Count >= GameGlobals.MaxNumberPartyPlayers) { return(true); } var ScaleLevelMax = 3; var ScaleLevelMin = 1; // Get 6 Characters do { var Data = GetRandomCharacter(ScaleLevelMin, ScaleLevelMax); CharacterList.Add(Data); } while (CharacterList.Count < GameGlobals.MaxNumberPartyPlayers); return(true); }
public virtual void Write(CharacterList characterList, string fileLocation) { StreamWriter writer = new StreamWriter(fileLocation); Write(characterList, writer); writer.Flush(); writer.Close(); }
/// <summary> /// 显示角色列表 /// </summary> public void ShowCharacterTable() { foreach (var model in GetCharacterList()) { CharacterList.Add(model); } ShowCharacterList(); }
void AnimAlpha_Command(string[] param) { int char_index = OldVSNController.GetInstance().charList.GetCharIdByParam(param[0]); float alpha = float.Parse(param[1]); float time = float.Parse(param[2]); CharacterList.GetInstance().AnimateAlpha(char_index, time, alpha); }
/// <param name="characterLists">A list of expressions specifying character lists.</param> /// <remarks> /// <para> /// A character list expression specifies a list of characters and a number of characters to choose from that list. /// A character followed by a hyphen ('-') and another character specifies a range, including all characters between the bounds inclusively. /// Other characters are directly included in the list. /// A hyphen may be included in the list by placing it at the start or end of the string, or immediately after a range. /// </para> /// <para> /// The expression may be prefixed with a positive integer followed by a '*'. This specifies the number of characters to choose from the list. /// If no count is specified, one character is chosen. /// </para> /// </remarks> public Strings(params string[] characterLists) { this.characterLists = new CharacterList[characterLists.Length]; for (int i = characterLists.Length - 1; i >= 0; --i) { this.characterLists[i] = CharacterList.Parse(characterLists[i]); } }
public ActionResult EditCharacter(Character character) { //service. CharacterList model = service.GetAllCharacters(); return(View("AllCharacters", model)); }
void Awake() { characterList = GameObject.Find("GameManager").GetComponent<CharacterList>(); LastUsedHeroPanel = gameObject.transform.GetChild(0).FindChild("StageHistoryPanel").FindChild("LastUsedHeroPanel").gameObject; //to get stage list panel StageListPanel = gameObject.transform.GetChild(0).FindChild("StageListPanel").gameObject; //to get selected stage panel SelectedStagePanel = gameObject.transform.GetChild(0).FindChild("SelectedStagePanel").gameObject; StageListImageComp = new Image[StageListPanel.transform.GetChild(0).childCount]; setLastUsedHeroPanel(); //set the initial stage list initStagesList(); initStagePreview(); }
void Awake() { characterList = GameObject.Find("GameManager").GetComponent<CharacterList>(); //to get character list panel CharThumbnailHolder = GameObject.Find("CharThumbnailHolder").gameObject; charThumbnailHolderRect = GameObject.Find("CharThumbnailHolder").GetComponent<RectTransform>(); selectedHeroFrameTr = GameObject.Find("SelectedFrame").GetComponent<RectTransform>(); charThumbnailHolderMovementRange[0] = 0; charThumbnailHolderMovementRange[1] = CharThumbnailHolder.transform.childCount - 5; distanceBetweenCharThumbList = Vector2.Distance(CharThumbnailHolder.transform.GetChild(0).GetComponent<RectTransform>().anchoredPosition, CharThumbnailHolder.transform.GetChild(1).GetComponent<RectTransform>().anchoredPosition); //to get selected hero panel PreviewHeroPanel = GameObject.Find("PreviewHeroPanel").gameObject; //get lock image to show if the hero is locked LockImageGO = GameObject.Find("Lock").gameObject; //to get heroes position panel HeroesPlacementHolder = GameObject.Find("HeroesHolder").gameObject; //set the initial character list //get the use 4 heroes prompt and disable it useFourHeroesPromptGO = GameObject.Find("useFourHeroesPromptBox"); //use four heroes prompt box must be set active in editor! useFourHeroesPromptGO.SetActive(false); //initialize selected hero listSelectedHero = new int[4] { 0, 0, 0, 0 }; //Todo --> load last selected hero //set active hero automatically based on this selected hero //initialize things in character selection selectedHero = 0; filledHeroesPosition = -1; initHeroesList(); initHeroPreview(); initHeroesPositioning(); validateLockedHero(0); }
void Awake() { instance = this; characterList = GameObject.Find("GameManager").GetComponent<CharacterList>(); preparationTime = GetComponent<PreparationTime>(); }