private void OnGameCreated(FightInfo fightInfo) { if (m_ui != null) { m_ui.StartCoroutine(StartGame(fightInfo)); } }
private IEnumerator StartGame(FightInfo fightInfo) { StatesUtility.ClearOptionLayer(); yield return(ApplyFightInfos(fightInfo)); yield return(m_ui.GotoVersusAnim()); yield return((object)new WaitForTime(2f)); StateLayer defaultLayer = StateManager.GetDefaultLayer(); StateContext currentState = defaultLayer.GetChildState(); if (currentState != null) { defaultLayer.ClearChildState(0); while ((int)currentState.get_loadState() == 8) { yield return(null); } } FightState fightState = new FightState(fightInfo); defaultLayer.SetChildState(fightState, 0); VersusState versusState = new VersusState(m_ui, fightState); this.SetChildState(versusState, 0); }
protected override void DoAbilityAction(FightInfo fight) { fight.Hero.TakeMagicDamage(3); fight.Hero.FleeSymbols--; Animator.SetTrigger("Ability"); AudioPlayer.Play(AudioPlayer.Ability); }
public void MergePets_Single() { var fs = new FightInfo(MOB1); var p1 = new FightParticipant() { Name = PLAYER1, OutboundHitSum = 100 }; fs.Participants.Add(p1); var p2 = new FightParticipant() { Name = PLAYER2, OutboundHitSum = 110 }; fs.Participants.Add(p2); var pet1 = new FightParticipant() { Name = PET1, OutboundHitSum = 50, PetOwner = PLAYER1 }; fs.Participants.Add(pet1); fs.MergePets(); var ap1 = fs.Participants.Find(x => x.Name == PLAYER1); Assert.Equal(150, ap1.OutboundHitSum); var ap2 = fs.Participants.Find(x => x.Name == PLAYER2); Assert.Equal(110, ap2.OutboundHitSum); var apet1 = fs.Participants.Find(x => x.Name == PET1); Assert.Equal(0, apet1.OutboundHitSum); }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10u: if (fightInfo_ == null) { fightInfo_ = new FightInfo(); } input.ReadMessage(fightInfo_); break; case 16u: FightDefId = input.ReadInt32(); break; case 24u: FightType = input.ReadInt32(); break; } } }
private bool IsFilterMatch(FightInfo f) { return(f.Name.Contains(textSearch.Text, StringComparison.OrdinalIgnoreCase) || f.Zone.Contains(textSearch.Text, StringComparison.OrdinalIgnoreCase) || f.Participants.Any(x => x.Name.StartsWith(textSearch.Text, StringComparison.OrdinalIgnoreCase)) ); }
protected override void DoAbilityAction(FightInfo fight) { fight.Hero.HPcurrent -= 2; fight.Enemy.HPcurrent += 2; Animator.SetTrigger("Ability"); AudioPlayer.Play(AudioPlayer.Ability); }
private void ViewFight(FightInfo f) { //var s = new StringBuilder(); //var writer = new StringWriter(s); //f.WriteNotes(writer); //LogInfo(s.ToString()); lvPlayers.BeginUpdate(); lvPlayers.Items.Clear(); var top = f.Participants.Max(x => x.OutboundHitSum); // show participants that did damage foreach (var p in f.Participants.Where(x => x.OutboundHitSum > 0)) { var item = lvPlayers.Items.Add(p.Name); item.SubItems.Add(p.Class); item.SubItems.Add(FightUtils.FormatNum(p.OutboundHitSum)); item.SubItems.Add(((double)p.OutboundHitSum / top).ToString("P0")); item.SubItems.Add(p.Duration.ToString() + 's'); item.SubItems.Add(FightUtils.FormatNum(p.OutboundHitSum / f.Duration)); //var damage = String.Join(", ", p.AttackTypes.Take(4).Select(x => $"{(double)x.HitSum / p.OutboundHitSum:P0} {x.Type}")); var notes = String.Join(", ", p.AttackTypes.Take(4).Select(x => $"{FightUtils.FormatNum(x.HitSum / f.Duration)} {x.Type}")); var other = p.AttackTypes.Skip(4).Sum(x => x.HitSum); if (other > 0) { notes += $", {FightUtils.FormatNum(other / f.Duration)} other"; } if (p.Buffs.Any(x => x.Name == BuffTracker.DEATH)) { notes = "DIED - " + notes; } item.SubItems.Add(notes); } lvPlayers.EndUpdate(); }
public FightStartedEvent(FightStartedEvent other) : this() { fightInfo_ = ((other.fightInfo_ != null) ? other.fightInfo_.Clone() : null); fightDefId_ = other.fightDefId_; fightType_ = other.fightType_; _unknownFields = UnknownFieldSet.Clone(other._unknownFields); }
public FightState(FightInfo fightInfo, bool hardResumed = false) { m_fightInfo = fightInfo; m_ownFightId = fightInfo.OwnFightId; m_fightDefId = fightInfo.FightDefId; m_fightMapId = fightInfo.FightMapId; m_concurrentFightsCount = fightInfo.ConcurrentFightsCount; m_hardResumed = hardResumed; }
private bool IsTrashMob(FightInfo f) { //var zoneAvg = fightList.Take(20).Where(x => x.Zone == f.Zone && x.Status == FightStatus.Killed).Select(x => x.HP).DefaultIfEmpty(0).Average(); //LogInfo("Avg: " + zoneAvg); //if (zoneAvg > 0 && f.HP > zoneAvg * 0.5) // return false; return(f.IsTrash); }
private void Reroll(FightInfo fight) { foreach(var dice in fight.DicesInfo.Dices) { if (dice.Slot.SideOfTable == Side.Right) { dice.RollingResult = Random.Range(0, Constants.FightDiceDimensionNumber - 1); } } }
/// <summary> /// Dump a fight summary to the console. /// </summary> static void ShowFight(FightInfo f) { if (f.Status == FightStatus.Active) { Console.WriteLine("\n--- {0} --- started at {1}", f.Target.Name, f.StartedOn.ToLocalTime()); return; } Console.Out.WriteLongSummary(f); }
public void Merge_Buffs_With_Gap() { var a = new FightInfo(); a.StartedOn = DateTime.Parse("11:01:05"); a.UpdatedOn = a.StartedOn.AddSeconds(14); // 4 intervals: 0..5, 6..11, 12..15, 16..19 a.Target = new FightParticipant() { Name = "Mob1" }; var ap1 = new FightParticipant() { Name = "Player1", OutboundHitSum = 1 }; ap1.Buffs.Add(new FightBuff { Name = "Super Speed", Time = 2 }); a.Participants.Add(ap1); // second fight starts with a gap after the first fight var b = new FightInfo(); b.Target = new FightParticipant() { Name = "Mob2" }; b.StartedOn = a.StartedOn.AddMinutes(1); b.UpdatedOn = b.StartedOn.AddSeconds(12); var bp1 = new FightParticipant() { Name = "Player1", OutboundHitSum = 1 }; bp1.Buffs.Add(new FightBuff { Name = "Super Speed", Time = 3 }); b.Participants.Add(bp1); // act var total = new MergedFightInfo(); total.Merge(a); total.Merge(b); total.Finish(); // assert Assert.Single(total.Participants); var p = total.Participants[0]; Assert.Equal(2, p.Buffs.Count); Assert.Equal(2, p.Buffs[0].Time); Assert.Equal(27, p.Buffs[1].Time); // 24 from 4*6 intervals in first fight + 3 second offset }
public void Merge_DPS_Intervals_For_Participant_With_Gap() { var a = new FightInfo(); a.StartedOn = DateTime.Parse("11:01:05"); a.UpdatedOn = a.StartedOn.AddSeconds(14); a.Target = new FightParticipant() { Name = "Mob1" }; a.Participants.Add(new FightParticipant() { Name = "Player1", DPS = new List <int> { 0, 3, 0 } }); a.Participants.Add(new FightParticipant() { Name = "Player2", DPS = new List <int> { 2, 6, 3 } }); // second fight starts with a gap after the first fight var b = new FightInfo(); b.Target = new FightParticipant() { Name = "Mob2" }; b.StartedOn = a.StartedOn.AddMinutes(1); b.UpdatedOn = b.StartedOn.AddSeconds(12); b.Participants.Add(new FightParticipant() { Name = "Player1", DPS = new List <int> { 7, 23 } }); // act var total = new MergedFightInfo(); total.Merge(a); total.Merge(b); total.Finish(); // assert Assert.Equal(2, total.Participants.Count); var p = total.Participants[0]; // :00 to :05, :06 to :11, :12 to :17, :18 to :23, gap should be ignored, :00 to :05, :06 to :11 Assert.Equal(new[] { 0, 3, 0, 0, 7, 23 }, p.DPS); }
public void Flags_Strikethrough() { var fs = new FightInfo(MOB1); fs.AddHit(new LogHitEvent { Source = PLAYER1, Target = MOB1, Mod = LogEventMod.Riposte | LogEventMod.Strikethrough | LogEventMod.Lucky, Amount = 1 }); var p = fs.Participants[0]; Assert.Equal(1, p.OutboundStrikeCount); }
public void MergePets_Multiple() { var fs = new FightInfo(MOB1); var p1 = new FightParticipant() { Name = PLAYER1, OutboundHitSum = 100 }; fs.Participants.Add(p1); var pet1 = new FightParticipant() { Name = PET1, OutboundHitSum = 50, AttackTypes = new List <FightHit> { new FightHit() { Type = "kick", HitCount = 1, HitSum = 50 } }, PetOwner = PLAYER1 }; fs.Participants.Add(pet1); var pet2 = new FightParticipant() { Name = PET2, OutboundHitSum = 60, AttackTypes = new List <FightHit> { new FightHit() { Type = "kick", HitCount = 1, HitSum = 60 } }, PetOwner = PLAYER1 }; fs.Participants.Add(pet2); fs.MergePets(); var ap1 = fs.Participants.Find(x => x.Name == PLAYER1); Assert.Equal(210, ap1.OutboundHitSum); var ap1kick = ap1.AttackTypes.Find(x => x.Type == "pet:kick"); Assert.NotNull(ap1kick); Assert.Equal(2, ap1kick.HitCount); Assert.Equal(110, ap1kick.HitSum); var apet1 = fs.Participants.Find(x => x.Name == PET1); Assert.Equal(0, apet1.OutboundHitSum); var apet2 = fs.Participants.Find(x => x.Name == PET2); Assert.Equal(0, apet2.OutboundHitSum); }
public void Merge_DPS_Intervals_For_Participant_With_Overlap() { var a = new FightInfo(); a.StartedOn = DateTime.Parse("11:01:05"); a.UpdatedOn = a.StartedOn.AddSeconds(14); a.Target = new FightParticipant() { Name = "Mob1" }; a.Participants.Add(new FightParticipant() { Name = "Player1", DPS = new List <int> { 0, 3, 0 } }); a.Participants.Add(new FightParticipant() { Name = "Player2", DPS = new List <int> { 2, 6, 3 } }); // second fight starts before the first is finished var b = new FightInfo(); b.Target = new FightParticipant() { Name = "Mob2" }; b.StartedOn = a.StartedOn.AddSeconds(2); b.UpdatedOn = b.StartedOn.AddSeconds(12); b.Participants.Add(new FightParticipant() { Name = "Player1", DPS = new List <int> { 7, 23 } }); // act var total = new MergedFightInfo(); total.Merge(a); total.Merge(b); total.Finish(); // assert Assert.Equal(2, total.Participants.Count); var p = total.Participants[0]; // :00 to :05, :06 to :11, :12 to :17 Assert.Equal(new[] { 0, 10, 23 }, p.DPS); }
private bool IsAdd(FightInfo _DstInfo) { for (int i = _DstInfo.m_DefenceInfo.Length - 1; i >= 0; i--) { if (_DstInfo.m_DefenceInfo[i].m_Defencer == 0) { continue; } if (_DstInfo.m_DefenceInfo[i].m_RemainHP == 0) { return(true); } } return(false); }
public void MergeFrom(FightInfoEvent other) { if (other == null) { return; } if (other.fightInfo_ != null) { if (fightInfo_ == null) { fightInfo_ = new FightInfo(); } FightInfo.MergeFrom(other.FightInfo); } _unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public void Flags_Critical() { var fs = new FightInfo(MOB1); fs.AddHit(new LogHitEvent { Source = PLAYER1, Target = MOB1, Type = "slash", Mod = LogEventMod.Strikethrough | LogEventMod.Lucky, Amount = 1 }); fs.AddHit(new LogHitEvent { Source = PLAYER1, Target = MOB1, Type = "slash", Mod = LogEventMod.Critical | LogEventMod.Strikethrough | LogEventMod.Lucky, Amount = 3 }); var p = fs.Participants[0]; Assert.Equal(1, p.AttackTypes[0].CritCount); Assert.Equal(3, p.AttackTypes[0].CritSum); }
private async Task <bool> UploadFight(FightInfo f) { if (!uploader.IsReady) { return(false); } fightStatus[f.ID] = "Uploading..."; lvFights.Invalidate(); var result = await uploader.UploadFight(f); fightStatus[f.ID] = result ? "Uploaded" : "Failed"; lvFights.Invalidate(); return(result); }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { if (num != 10) { _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); continue; } if (fightInfo_ == null) { fightInfo_ = new FightInfo(); } input.ReadMessage(fightInfo_); } }
// 技能结束时,缓存此次技能生成的战斗信息 [3/23/2015 Zmy] public void OnCacheSepllInfo() { FightInfo _info = new FightInfo(); bool bAttacker = m_pHolder.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO ? true : false; _info.SetAttack(m_pHolder.GetTeamPos(), bAttacker); _info.m_SpellID = m_pSpellInfo.GetSpellID(); _info.m_nCount = (byte)m_TargetList.m_nCount; for (int i = 0; i < m_ValidImpact.Length; ++i) { if (m_ValidImpact[i] < 0) { continue; } //只记录有效的Impact [3/23/2015 Zmy] _info.m_Impact[i] = m_ValidImpact[i]; _info.m_nImpactCount++; } for (int n = 0; n < m_TargetList.m_nCount; ++n) { DefenceInfo _deInfo = new DefenceInfo(); bool _bAttacker = m_TargetList.m_pObjectList[n].m_pTargetObject.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_MONSTER ? true : false; _deInfo.SetDefencer(m_TargetList.m_pObjectList[n].m_pTargetObject.GetTeamPos(), _bAttacker); _deInfo.m_Hit = m_TargetList.m_pObjectList[n].m_bHit; for (int nIndex = 0; nIndex < m_TargetList.m_pObjectList[n].m_ValidImpact.Length; ++nIndex) { if (m_TargetList.m_pObjectList[n].m_ValidImpact[nIndex] < 0) { continue; } _deInfo.m_Impact[nIndex] = m_TargetList.m_pObjectList[n].m_ValidImpact[nIndex]; _deInfo.m_nImpactCount++; } _deInfo.m_RemainHP = m_TargetList.m_pObjectList[n].m_pTargetObject.GetHP(); _info.m_DefenceInfo[n].Copy(_deInfo); } SceneObjectManager.GetInstance()._CacheFightInfo(_info); }
// Use this for initialization void Start() { if (Instance != null) { Destroy(Instance.gameObject); } Instance = this; AdventureController.Instance.BindMe(this); Hero = Instantiate(AdventureController.Instance.Hero); AdventureController.Instance.Hero = Hero; DontDestroyOnLoad(Hero.gameObject); Room = AdventureController.Instance.Map.Compartments[AdventureController.Instance.PlayerCompartmentNumber] as RoomClass; BackgroundSprites = new System.Collections.Generic.List<GameObject>(); HeroGameObject = Hero.gameObject; BackgroundSprites.Add(CreateGameObjectBySprite(Room.Background)); for (int i = 0; i < 2; i++) { Dices.Add(Instantiate(d8DicePrefab)); Dices[i].ResetPosition(); } if (Room.Type == FloodedTempleRoomType.Training) { isFighting = true; isExploring = false; Fight = new FightInfo(); Fight.Hero = Hero; Fight.Enemy = GameObject.Instantiate(Room.Enemy); StartCoroutine(WriteForTime(MainMessageText, "FIGHT!", 1f)); StartCoroutine(WriteForTime(MainMessageText, "FIGHT!", 1f)); } else { isFighting = false; isExploring = true; } }
private void BroadcastGameUserInfo(ICollection <GameUserInfo> game_info_list) { GameUserInfo[] game_info_array = game_info_list.ToArray(); int[] left_info; int[] right_info; if (game_info_array[0].Avartar_Direction == 0) { left_info = new int[] { game_info_array[0].Hp_, game_info_array[0].Score_ }; right_info = new int[] { game_info_array[1].Hp_, game_info_array[1].Score_ }; } else { left_info = new int[] { game_info_array[1].Hp_, game_info_array[1].Score_ }; right_info = new int[] { game_info_array[0].Hp_, game_info_array[0].Score_ }; } FightInfo fight_info = FightInfo.CreateFightInfo(left_info, right_info); Broadcast_Data_(EwkProtoFactory.CreateIEwkProtocol <FightInfo>(ProtocolEnum.FightInfo, fight_info).GetBytes); }
public void Death_of_Mob() { FightInfo f = null; var chars = new CharTracker(); chars.GetOrAdd(PLAYER1).Type = CharType.Friend; var tracker = new FightTracker(new SpellParser(), chars); tracker.OnFightFinished += (args) => f = args; tracker.HandleEvent(new LogHitEvent { Timestamp = DateTime.Now, Source = PLAYER1, Target = "Mob1", Type = "slash", Amount = 100 }); tracker.HandleEvent(new LogDeathEvent { Timestamp = DateTime.Now.AddSeconds(1), Name = "Mob1" }); Assert.NotNull(f); Assert.Equal("Mob1", f.Target.Name); Assert.Empty(tracker.ActiveFights); }
public override int GetHashCode() { int num = 1; if (fightInfo_ != null) { num ^= FightInfo.GetHashCode(); } if (FightDefId != 0) { num ^= FightDefId.GetHashCode(); } if (FightType != 0) { num ^= FightType.GetHashCode(); } if (_unknownFields != null) { num ^= ((object)_unknownFields).GetHashCode(); } return(num); }
public async Task <bool> UploadFight(FightInfo f) { // don't upload the same thing multiple times if (uploadLog.Contains(f.ID)) { logger("Already uploaded " + f.Name); return(true); } logger("Uploading " + f.Name); var json = JsonSerializer.Serialize(f); //File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\sample.json", json); var content = new StringContent(json, Encoding.UTF8, "application/json"); try { //var result = await httpClient.PostAsync(uploadUrl + "/logs/fight/" + privateKey, content); var result = await httpClient.PostAsync(uploadUrl + "/logs/fight", content); if (result.IsSuccessStatusCode) { uploadLog.Add(f.ID); //logger("Upload completed."); return(true); } else { logger("Upload error: " + result.StatusCode + " " + await result.Content.ReadAsStringAsync()); return(false); } } catch (Exception ex) { logger("Upload error: " + ex.Message); return(false); } }
public void MergeFrom(FightStartedEvent other) { if (other == null) { return; } if (other.fightInfo_ != null) { if (fightInfo_ == null) { fightInfo_ = new FightInfo(); } FightInfo.MergeFrom(other.FightInfo); } if (other.FightDefId != 0) { FightDefId = other.FightDefId; } if (other.FightType != 0) { FightType = other.FightType; } _unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
protected override void DoAbilityAction(FightInfo fight) { Effects.Add(new Effect(Characteristics.Armor, 30, EffectTypes.Buff, 2, DurationTypes.Rounds)); Animator.SetTrigger("Ability"); AudioPlayer.Play(AudioPlayer.Ability); }
private void MagicBurst(FightInfo fight) { fight.Enemy.TakeMagicDamage(5); }
protected override void DoEscapeAction(FightInfo fight) { DoAttackAction(fight); }
private void OnGameCreated(FightInfo fightInfo) { StatesUtility.DoTransition(new FightState(fightInfo), StateManager.GetDefaultLayer().GetChildState()); }
private void Laceration(FightInfo fight) { fight.Enemy.Effects.Add(new Effect(Characteristics.HPcurrent, -3, EffectTypes.Repeat, 3, DurationTypes.Rounds)); }
protected void DoEscapeAction(FightInfo fight) { if (fight.Hero.HPcurrent/this.AttackDmg > this.HPcurrent / fight.Hero.AttackDmg) { if (Random.Range(1, 100) < this.ChanceToFlee) { WantsToGlee = true; } } }
protected void DoNothingAction(FightInfo fight) { }
FightInfo processSyncAction(JsonData gameData) { FightInfo fInfo = new FightInfo(); int attacker = 0; int defender = 0; if (gameData.IsObject == false) { return null; } int.TryParse((string)gameData["attacker"], out attacker); int.TryParse((string)gameData["defender"], out defender); fInfo.attackerId = attacker; fInfo.defenderId = defender; fInfo.block = (bool)gameData["block"]; fInfo.stun = (bool)gameData["stun"]; fInfo.critical = (bool)gameData["critical"]; fInfo.hitPoints = (int)gameData["hit_points"]; fInfo.type = (string)gameData["type"]; fInfo.param = (string)gameData["param"]; return fInfo; }
void startAction(FightInfo info) { bool attacking = (info.attackerId == leftUser.id); bool block = info.block; AnimationHelper.MoveGO(leftPlayer, leftPlayer.transform.position, enemyAnimation.HitSuc(), movePlayers); AnimationHelper.MoveGO(rightPlayer, rightPlayer.transform.position, enemyAnimation.EHitSuc(), movePlayers); AnimationHelper.MoveGO(objectHolder.mainCamera.gameObject, objectHolder.mainCamera.gameObject.transform.position, enemyAnimation.CHitSuc(), moveCamera); }
private void ArmorBoost(FightInfo fight) { fight.Hero.Effects.Add(new Effect(Characteristics.Armor, 30, EffectTypes.Buff, 1, DurationTypes.DmgTaken)); }
IEnumerator ProcessSync(string text) { String status = ""; bool exception = false; int timer = 0; Action[] belt = new Action[0]; Action[] aurSkills = new Action[0]; Action[] actSkills = new Action[0]; FightInfo fInfo = null; try { JsonData data = JsonMapper.ToObject (text); Debug.Log ("WWW Sync Ok!: " + text); string result = (string)data["status"]; Debug.Log ("result: " + result); if (result != "success") { throw new Exception(); } JsonData gameData = data["data"]; processSync(gameData, out status, out timer, out actSkills, out aurSkills, out belt); fInfo = processSyncAction(gameData["action"]); } catch (Exception e) { Debug.Log("WWW Exception!: " + e.Message); CloseApp(); exception = true; } if (exception == false) { if (rightUser.id != _opponentId) { string req = "http://api.gw.monospacelabs.com/v1/battle/equipment"; req += "?opponent_id=" + rightUser.id + "&email=" + _userName; GET(req, REQUEST_EQUIP); _opponentId = rightUser.id; } // UI Thread yield return Ninja.JumpToUnity; bool needUpdate = true; if (fInfo != null && leftPlayer != null && rightPlayer != null) { if (fInfo == lastFight) { needUpdate = true; } else { needUpdate = false; lastFight = fInfo; startAction(fInfo); } } if (needUpdate) { objectHolder.statusLabel.text = status; objectHolder.timer.text = timer.ToString(); ApplyNewUIData(); } else { objectHolder.statusLabel.text = ""; objectHolder.timer.text = ""; } objectHolder.bHelper.InitButtons(actSkills, aurSkills, belt, objectHolder); objectHolder.bHelper.SetState(objectHolder, status); yield return Ninja.JumpBack; } yield return false; }
private void Bite(FightInfo fight) { fight.Enemy.TakeMagicDamage(5); }
private void BrokeFinger(FightInfo fight) { fight.Enemy.Effects.Add(new Effect(Characteristics.AttackDmg, -5, EffectTypes.Curse, 3, DurationTypes.Rounds)); }
protected void DoEscapeAction(FightInfo fight) { }
protected void DoAttackAction(FightInfo fight) { fight.Hero.HPcurrent -= (int)(this.AttackDmg * (1 - (float)fight.Hero.Armor / 100)); OnAttack(); fight.Hero.OnDmgTaken(); }
protected void Faster(FightInfo fight) { Effects.Add(new Effect(Characteristics.AttackDmg, 2, EffectTypes.Buff, 5, DurationTypes.Rounds)); }
protected void DoDefenceAction(FightInfo fight) { Effects.Add(new Effect(Characteristic.Armor, 100, EffectType.Buff, 1, DurationType.Rounds)); }
protected virtual void DoAttackAction(FightInfo fight) { fight.Hero.TakePhysicalDamage(this.AttackDmg); OnAttack(); Animator.SetTrigger("Attack"); AudioPlayer.Play(AudioPlayer.Attack); }
protected void DoHealAction(FightInfo fight) { this.HPcurrent += this.HealAmount; if (HPcurrent > HPBars) { HPcurrent = HPBars; } }
protected virtual void DoDefenceAction(FightInfo fight) { Effects.Add(new Effect(Characteristics.Armor, 100, EffectTypes.Buff, 1, DurationTypes.Rounds)); Animator.SetTrigger("Defence"); AudioPlayer.Play(AudioPlayer.Defence); }
public override void read(ErlKVMessage message) { ErlType type = message.getValue("msg") as ErlType; if (type == null) { return; } if (type is ErlArray) { ErlArray erlArray = message.getValue("msg") as ErlArray; if (erlArray.Value.Length == 0) { return; } int fightedTimes = StringKit.toInt(erlArray.Value[0].getValueString()); AttackBossOneOnOneManager.Instance.canChallengeTimes = CommandConfigManager.Instance.getTimesOfDay() - fightedTimes; AttackBossOneOnOneManager.Instance.bossSid = StringKit.toInt(erlArray.Value[1].getValueString()); string beastUid = erlArray.Value[2].getValueString(); if (beastUid != "0") { AttackBossOneOnOneManager.Instance.choosedBeast = StorageManagerment.Instance.getBeast(beastUid); } AttackBossOneOnOneManager.Instance.totalDamage = erlArray.Value[3].getValueString(); ErlArray cardInfoErl = erlArray.Value[4] as ErlArray; List <string> list = new List <string>(); for (int i = 0; i < cardInfoErl.Value.Length; i++) { ErlArray array = cardInfoErl.Value[i] as ErlArray; if (array.Value[1].getValueString() == "2") { list.Add(array.Value[0].getValueString()); } } AttackBossOneOnOneManager.Instance.usedCardUid = list; ErlArray fightInfoErl = erlArray.Value[5] as ErlArray; AttackBossOneOnOneManager.Instance.buyTimes = StringKit.toInt(erlArray.Value[6].getValueString()); List <FightInfo> fightInfoList = new List <FightInfo>(); for (int k = 0; k < fightInfoErl.Value.Length; k++) { FightInfo fight = new FightInfo(); ErlArray tempErl = fightInfoErl.Value[k] as ErlArray; if (tempErl.Value.Length == 0) { continue; } fight.cardSid = StringKit.toInt(tempErl.Value[0].getValueString()); fight.beastSid = StringKit.toInt(tempErl.Value[1].getValueString()); fight.bossSid = StringKit.toInt(tempErl.Value[2].getValueString()); fight.damage = tempErl.Value[3].getValueString(); fightInfoList.Add(fight); } AttackBossOneOnOneManager.Instance.fightInfo = fightInfoList; if (callback != null) { callback(); callback = null; } } else { if (callback != null) { callback(); callback = null; } //MaskWindow.UnlockUI(); } }
protected virtual void DoEscapeAction(FightInfo fight) { FleeSymbols++; }
protected void StartFight(AbEnemy enemy) { isFighting = true; isExploring = false; Fight = new FightInfo(); Fight.Hero = Hero; Fight.Enemy = enemy; StartCoroutine(WriteForTime(MainMessageText, "В БОЙ!", 1f)); }
protected virtual void DoHealAction(FightInfo fight) { this.HPcurrent += this.HealAmount; Animator.SetTrigger("Heal"); AudioPlayer.Play(AudioPlayer.Heal); }
private void AddFight(FightInfo f) { if (f.Zone == null) { f.Zone = "Unknown"; } if (IsTrashMob(f)) { fightStatus[f.ID] = "Trash"; } // ignore mobs we may have hit but blurred, rooted, or otherwise ignored if (IsTrashMob(f) && f.Status == FightStatus.Timeout) { //LogInfo("Ignoring trash: " + f.Name); return; } /* * // consolidate with recent "trash" mobs * if (IsTrashMob(f)) * { * // find the last synthetic "trash" fight that we can consolidate this with * var trash = fightList.OfType<MergedFightInfo>() * .Where(x => x.Zone == f.Zone && x.Name.StartsWith("Trash")) * //.Where(x => x.StartedOn <= f.StartedOn) // prevents out of order merges, but creates extra "trash" fights sometimes * .Where(x => x.StartedOn >= f.StartedOn.AddMinutes(-5)) * .FirstOrDefault(); * * if (trash == null) * { * trash = new MergedFightInfo(); * fightList.Insert(0, trash); * } * else * { * fightList.Remove(trash); * fightList.Insert(0, trash); * } * trash.Merge(f); * trash.Trim(); * trash.Finish(); * trash.Name = $"Trash ({trash.MobCount} mobs)"; * * // return without uploading * return; * } */ fightList.Insert(0, f); if (fightListSearchResults == null) { lvFights.VirtualListSize = fightList.Count; } else if (IsFilterMatch(f) || f.MobCount > 1) { fightListSearchResults.Insert(0, f); lvFights.VirtualListSize = fightListSearchResults.Count; } toolStripStatusLabel2.Text = fightList.Count + " fights"; if (f.MobCount > 1) { // if we just combined several fights then clear the selection lvFights.SelectedIndices.Clear(); lvFights.SelectedIndices.Add(0); lvFights.EnsureVisible(0); } else if (lvFights.SelectedIndices.Count > 1) { // if inserting the fight at index 0, we need to shift all the SelectedIndices down by one var selected = lvFights.SelectedIndices.OfType <int>().ToList(); lvFights.SelectedIndices.Clear(); foreach (var i in selected) { lvFights.SelectedIndices.Add(i + 1); } } if (chkAutoUpload.Checked && f.Status == FightStatus.Killed && !IsTrashMob(f)) { _ = UploadFight(f); _ = UploadLoot(); } }
public void DoAction(d8DiceDimensions actionType, FightInfo fight) { switch (actionType) { case d8DiceDimensions.Attack1: case d8DiceDimensions.Attack2: case d8DiceDimensions.Attack3: DoAttackAction(fight); break; case d8DiceDimensions.Ability: DoAbilityAction(fight); break; case d8DiceDimensions.Nothing: DoNothingAction(fight); break; case d8DiceDimensions.Defence: DoDefenceAction(fight); break; case d8DiceDimensions.Escape: DoEscapeAction(fight); break; case d8DiceDimensions.Heal: DoHealAction(fight); break; } }
private IEnumerator ApplyFightInfos(FightInfo fightInfo) { FightInfo.Types.Player opponent = GetOpponent((IList <FightInfo.Types.Team>)fightInfo.Teams); yield return(m_ui.SetOpponent(opponent)); }
protected abstract void DoAbilityAction(FightInfo fight);
protected override void DoAbilityAction(FightInfo fight) { Effects.Add(new Effect(Characteristic.Mobility, 1, EffectType.Buff, 5, DurationType.Rounds)); }
protected void DoAbilityAction(FightInfo fight) { if (Equipment[(int)EquipmentTypes.Talisman] is AbTalisman && (Equipment[(int)EquipmentTypes.Talisman] as AbTalisman).Ability != null) { (Equipment[(int)EquipmentTypes.Talisman] as AbTalisman).Ability(fight); } else { Ability(fight); } Animator.SetTrigger("Ability"); AudioPlayer.Play(AudioPlayer.Ability); }