public FightEventData(FightEventData other) : this() { eventType_ = other.eventType_; eventId_ = other.eventId_; ParentEventId = other.ParentEventId; int1_ = other.int1_; int2_ = other.int2_; int3_ = other.int3_; int4_ = other.int4_; int5_ = other.int5_; int6_ = other.int6_; int7_ = other.int7_; string1_ = other.string1_; bool1_ = other.bool1_; cellCoord1_ = ((other.cellCoord1_ != null) ? other.cellCoord1_.Clone() : null); cellCoord2_ = ((other.cellCoord2_ != null) ? other.cellCoord2_.Clone() : null); companionReserveState1_ = other.companionReserveState1_; companionReserveState2_ = other.companionReserveState2_; damageReductionType1_ = other.damageReductionType1_; fightResult1_ = other.fightResult1_; gameStatistics1_ = ((other.gameStatistics1_ != null) ? other.gameStatistics1_.Clone() : null); teamsScoreModificationReason1_ = other.teamsScoreModificationReason1_; OptInt1 = other.OptInt1; OptInt2 = other.OptInt2; OptInt3 = other.OptInt3; OptInt4 = other.OptInt4; cellCoordList1_ = other.cellCoordList1_.Clone(); spellMovementList1_ = other.spellMovementList1_.Clone(); castTargetList1_ = other.castTargetList1_.Clone(); intList1_ = other.intList1_.Clone(); intList2_ = other.intList2_.Clone(); _unknownFields = UnknownFieldSet.Clone(other._unknownFields); }
public void FinishQTE(FightingEntity user, List <FightingEntity> targets, float power) { PlayerStats before, after; List <DamageReceiver> receivers = new List <DamageReceiver>(); int rawDamage = GetRawDamage(user.stats, power); foreach (FightingEntity target in targets) { int damage = (int)(rawDamage * target.stats.GetDamageMultiplierResistance()); if (!target.IsHeroTeam()) { damage *= 2; } InstantiateDamagePopup(target, damage); before = (PlayerStats)target.stats.Clone(); target.stats.hp.ApplyDelta(-damage); after = (PlayerStats)target.stats.Clone(); receivers.Add(new DamageReceiver(target, before, after)); } FightResult result = new FightResult(user, this, receivers); _battleFight.EndFight(result, this); }
private void EndMatch(FightResult result) { ShowPanel("MatchResult"); switch (result) { case FightResult.Victory: matchResultText.text = "VICTORY!\nYou defeated\n" + other.name; break; case FightResult.Defeat: matchResultText.text = "DEFEAT!\nYou lost to\n" + other.name; break; case FightResult.Draw: matchResultText.text = "DRAW!\nAgainst\n" + other.name; break; case FightResult.Dropped: matchResultText.text = "DROPPED!\n" + other.name + "\nTimed out"; break; default: throw new ArgumentOutOfRangeException("result", result, null); } me.isKinematic = true; other.isKinematic = true; }
private void EndMatch(FightResult result) { ShowPanel("MatchResult"); switch (result) { case FightResult.Victory: matchResultText.text = "VICTORY!\nYou defeated\n" + other.name; break; case FightResult.Defeat: matchResultText.text = "DEFEAT!\nYou lost to\n" + other.name; break; case FightResult.Draw: matchResultText.text = "DRAW!\nAgainst\n" + other.name; break; case FightResult.Dropped: matchResultText.text = "DROPPED!\n" + other.name + "\nTimed out"; break; default: throw new ArgumentOutOfRangeException("result", result, null); } me.isKinematic = true; other.isKinematic = true; }
public void Lose() { Result = FightResult.Lose; Hero.loses++; Hero.CurrentHealth = Hero.OriginalHealth; Monster.CurrentHealth = Monster.OriginalHealth; }
public override void setData(Dictionary <string, object> data) { this.uid = data["uid"].ToString(); if (this.uid == ((ClientRunTime)this._map).uid) { ((ClientRunTime)this._map).localPlayer = (ClientPlayerEntity)this; } this.cardGroup = (CardGroupAction)this._map.getNetObject((int)(data["cardGroup"])); this.partGroup = (PartGroupAction)this._map.getNetObject((int)(data["partGroup"])); this.shipId = data["shipId"].ToString(); this.index = (int)(data["index"]); this.name = data["name"].ToString(); if (data.ContainsKey("reviveAction")) { this.reviveAction = (TimeAction)this._map.getNetObject((int)(data["reviveAction"])); this.reviveAction.callBack = this.revive; } this.teamIndex = (int)(data["teamIndex"]); this.calls = new List <object>((object[])data["calls"]).ConvertAll <CallEntity>((object netId) => { return((CallEntity)this._map.getNetObject((int)(netId))); }); this.fightResult = (FightResult)this._map.getNetObject((int)(data["fightResult"])); this._attractShape = (GeomBase)this._map.getNetObject((int)(data["attractShape"])); this.headUrl = data["headUrl"].ToString(); base.setData(data); }
public GameEndedEvent(int eventId, int?parentEventId, FightResult result, GameStatistics gameStats, int fightDuration) : base(FightEventData.Types.EventType.GameEnded, eventId, parentEventId) { this.result = result; this.gameStats = gameStats; this.fightDuration = fightDuration; }
private void DefaultAttack(Creature enemy, int bodyPart = -1) { var myResult = (enemy as IAttackable).Attack(Game.Player, bodyPart); var myReport = FormatReport(myResult); var enemyResult = (Game.Player as IAttackable).Attack(enemy); var enemyReport = FormatReport(enemyResult); History.Add($"{myReport}\n{enemyReport}"); if (Game.Player.CurrentHealth < 1 && enemy.CurrentHealth < 1) { var fightResult = new FightResult { Subject = Game.Player, Object = enemy }; fightResult.IsTie = true; ActionAfterFight?.Invoke(fightResult); } else if (Game.Player.CurrentHealth < 1) { var fightResult = new FightResult { Subject = Game.Player, Object = enemy }; fightResult.Winner = fightResult.Object; ActionAfterFight?.Invoke(fightResult); Game.GoTo(Game.Screens.GameOver); } else if (enemy.CurrentHealth < 1) { var fightResult = new FightResult { Subject = Game.Player, Object = enemy }; fightResult.Winner = fightResult.Subject; ActionAfterFight?.Invoke(fightResult); } }
public FightResult StartFight(Player player) { var fightResult = new FightResult(player); // Run a complete fight // Check if we can do something 10 times a second (to account for lag) for (decimal sec = 0; sec <= _settings.FightLength; sec += Interval) { var rr = player.NewRound(sec, Interval); foreach (var a in rr.Attacks) { // non damage attacks never added to report totals for hit/crits if (a.IsHit && a.Damage > 0) { rr.TotalHits++; } if (a.IsCrit && a.Damage > 0) { rr.TotalCrits++; } rr.TotalDamage += a.Damage; } // Only save rounds with any actions if (rr.Attacks.Any()) { fightResult.RoundResults.Add(rr); fightResult.TotalDamage += rr.TotalDamage; fightResult.TotalHits += rr.TotalHits; fightResult.TotalCrits += rr.TotalCrits; } } return(fightResult); }
public void ThenFightResultShouldBe(FightResult expectedResult) { var fightManagement = objectContainer.Resolve <IFightManagement>(); FightResult result = fightManagement.GetLastFightResult(); Assert.AreEqual(expectedResult, result); }
public override void initConfig(Dictionary <string, object> data = null) { this.teamIndex = (int)(data["teamIndex"]); this.shipId = data["shipId"].ToString(); this.uid = data["uid"].ToString(); this.name = null == data["name"] ? this.uid : data["name"].ToString(); this.level = 1; //(data["level"]==null)?1:(int)data["level"]; this.ownerPlayer = this; this.id = "player"; this.headUrl = this.uid.IndexOf("-") == 0 ? this.name : data["head"] == null ? "" : ((Dictionary <string, object>)data["head"])["use"].ToString(); this.fightResult = new FightResult(this._map); this.fightResult.init(); this.cardGroup = new CardGroupAction(this._map); this.partGroup = new PartGroupAction(this._map); this.cardGroup.ids = new List <object>((object[])data["cardGroup"]).ConvertAll <Dictionary <string, object> >((object obj) => { return((Dictionary <string, object>)obj); }); this.cardGroup.init(this); this.partGroup.init(this); base.initConfig((Dictionary <string, object>)DataManager.inst.beckon[this.id]); this._attractShape = Collision.createGeom(this, new object[] { (int)this.getProperty(ConfigConstant.PROPERTY_ATTRACT) }); this.actionManager.addAction(this.cardGroup); this.actionManager.addAction(this.partGroup); this.updateLevel(); }
public void Win() { Result = FightResult.Win; Hero.wins++; Hero.Coins += Monster.Coins; Hero.CurrentHealth = Hero.OriginalHealth; Monster.CurrentHealth = Monster.OriginalHealth; Console.WriteLine("You got {0} coins!", Monster.Coins); }
public FightEndedState(FightResult end, GameStatistics gameStatistics, int fightTime) { if (gameStatistics == null) { m_subStates.Add(new EndGameResultState(end)); } else { m_subStates.Add(new EndGameStatsStateDemo(end, gameStatistics, fightTime)); } }
private void CheckIfAnyEntityDied(FightResult result, ActionBase action) { foreach (var damageReceiver in result.receivers) { if (damageReceiver.fighter.stats.hp.GetValue() <= 0) { DeathResult deathResult = new DeathResult(result.fighter, damageReceiver, action); Messenger.Broadcast <DeathResult>(Messages.OnEntityDeath, deathResult); } } }
private FightResult CreateResult(IDataRecord reader) {//UserID,[Date],Money,Cristals ,Expirience var result = new FightResult { Date = reader.GetDateTime(1), Money = reader.GetInt32(2), Crystals = reader.GetByte(3), Expirience = reader.GetByte(4), }; return(result); }
public static long GetPVPCoinsFromDuel(this GameDeck deck, FightResult res) { var step = (ExperienceManager.CalculateLevel(deck.SeasonalPVPRank, PVPRankMultiplier) / 10); if (step > 5) { step = 5; } var coinCnt = 40 + (20 * step); return((res == FightResult.Win) ? coinCnt : coinCnt / 2); }
public void FinishQTE(FightingEntity user, List <FightingEntity> targets, float power) { if (targets != null && targets.Count != 0) { int manaRestored = GetManaRestored(user, power); InstantiateDamagePopup(targets[0], manaRestored, DamageType.MANA_RECOVERY); PlayerStats heroStats = targets[0].stats; heroStats.mana.ApplyDelta(manaRestored); } FightResult result = new FightResult(user, this); _battleFight.EndFight(result, this); }
public void EndFight(FightResult fightResult, ActionBase action) { CheckIfAnyEntityDied(fightResult, action); // Mooks should broadcast their fights for clarity if (!fighter.isEnemy() && !fighter.IsHero()) { // TODO: do in more clean way ActionListener actionListener = fighter.GetComponent <ActionListener>(); actionListener.EchoMessage(fightResult.GetAnnouncerMessage()); } onFightEnd(fightResult); }
/// <summary> /// Adds the fight. /// </summary> /// <param name="result">The result.</param> public void AddFight(FightResult result) { var command = connection.CreateCommand(@"INSERT INTO Fights ( [UserID], [Money], [Cristals], [Expirience],[Date],[IsFarm],[SkillDifference] ) VALUES (@UserID, @Money, @Cristals, @Expirience,@Date,@IsFarm,@SkillDifference)"); command.AddParameter("@UserID", result.Rival.UserID); command.AddParameter("@Money", result.Money); command.AddParameter("@Cristals", result.Crystals); command.AddParameter("@Expirience", result.Expirience); command.AddParameter("@Date", result.Date); command.AddParameter("@IsFarm", result.Rival.Source == RivalSource.FromFarm); command.AddParameter("@SkillDifference", result.SkillDifference); command.ExecuteNonQuery(); }
static internal string GetFightStatus(FightResult result) { switch (result) { case FightResult.NoResult: return("(Н/Д)"); case FightResult.AttackersWin: return("Победа атакующих"); case FightResult.DefendersWin: return("Победа обороняющихся"); case FightResult.Stalemate: return("Пат"); default: throw new ArgumentOutOfRangeException(nameof(result), result, null); } }
//public Arena(Verbosity verbosity) //{ // _verbosity = verbosity; // _logger = new ConsoleLogger(Verbosity.Less); // _logger.SetNext(new ConsoleLogger(Verbosity.Detailed)); // _logger.SetNext(new ConsoleLogger(Verbosity.All)); //} public FightResult MakeFight(ReversiPlayer black, ReversiPlayer white, int times) { var fightResult = new FightResult(); for (int i = 0; i < times; i++) { var sw = new Stopwatch(); sw.Start(); GameResult gameResult = MakeFight(black, white, false); sw.Stop(); fightResult.AddResult(gameResult); Console.WriteLine(@" time:" + sw.ElapsedMilliseconds + @" ms"); } return(fightResult); }
public (Character attacker, Character defender) StartFight(int userId, int selectedCharId, int targetUserId, int selectedTargetCharId) { UserDbEntity u = _userRepository.GetAll().Include(x => x.Characters).FirstOrDefault(x => x.Id == userId); CharacterDbEntity uc = u.Characters.FirstOrDefault(x => x.Id == selectedCharId); UserDbEntity tu = _userRepository.GetAll().Include(x => x.Characters).FirstOrDefault(x => x.Id == targetUserId); CharacterDbEntity tuc = tu.Characters.FirstOrDefault(x => x.Id == selectedTargetCharId); FightResult result = _fightManager.Fight(uc, tuc); _userRepository.Update(result.TargetChar.User); Character attackerChar = uc.Build(); Character targetChar = tuc.Build(); return(attackerChar, targetChar); }
private string GetSceneName(FightResult end) { switch (end) { case FightResult.Victory: return("FightEndedWinUI"); case FightResult.Defeat: return("FightEndedLoseUI"); case FightResult.Draw: return("FightEndedDrawUI"); default: throw new ArgumentOutOfRangeException("end", end, null); } }
public void RPC_AnounceResult(FightResult result, int winActorNum)//master client가 모든 클라이언트들에게 승부결과를 통보 { switch (result) { case FightResult.Draw: DrawProcess(); break; case FightResult.Win: WinProcess(); break; case FightResult.Lose: LoseProcess(winActorNum); break; } }
public FightResult Fight(Squad other) { if (!IsEnemeyFor(other)) { throw new InvalidOperationException("No friendly fire allowed!"); } var damage = PotentialDamageTo(other); var result = new FightResult { Damage = damage, UnitsKilled = Math.Min(other.Units, damage / other.HitPoints), }; result.IsElimination = result.UnitsKilled == other.Units; other.Units -= result.UnitsKilled; return(result); }
public void FinishQTE(FightingEntity user, List <FightingEntity> targets, float power) { PlayerStats before, after; List <DamageReceiver> receivers = new List <DamageReceiver>(); foreach (FightingEntity target in targets) { before = (PlayerStats)target.stats.Clone(); // TODO: increase strength of buff based on power List <StatusAilment> inflicted = InflictStatuses(target); after = (PlayerStats)target.stats.Clone(); receivers.Add(new DamageReceiver(target, before, after, inflicted)); } FightResult result = new FightResult(user, this, receivers); _battleFight.EndFight(result, this); }
public override IEnumerator ExecuteAction(FightingEntity user, List <FightingEntity> targets, BattleFight battleFight) { _battleFight = battleFight; FightResult result = new FightResult(user, this); if (CheckCost(user)) { PayCost(user); targets = GetAllPossibleActiveTargets(user); Vector3 userStartingPos = user.transform.position; // Slide in if (animation != null && animation.slideType != SlideType.NONE) { yield return(GameManager.Instance.time.GetController().StartCoroutine(animation.SlideIn(user, targets))); } List <FightingEntity> potentialTargets = targets; for (int i = 0; i < _numHits; i++) { potentialTargets = targets.Filter(target => target != null); if (potentialTargets.Count == 0) { break; } List <FightingEntity> currTargets = SetTargets(user, targets); // Play animation GameManager.Instance.time.GetController().StartCoroutine(animation.AnimateAction(user, currTargets)); yield return(GameManager.Instance.time.GetController().WaitForSeconds(animation.GetAnimWindup(false))); result = ApplyEffect(user, currTargets); OnPostEffect(result); _battleFight.EndFight(result, this); yield return(GameManager.Instance.time.GetController().WaitForSeconds(animation.GetAnimCooldown(false))); } // Slide back if (animation != null && animation.slideType != SlideType.NONE) { yield return(GameManager.Instance.time.GetController().StartCoroutine(animation.Slide(user.transform, user.transform.position, userStartingPos))); } } }
/// <summary> /// Adds the cow. /// </summary> /// <param name="result">The result.</param> public void AddResult(FightResult result) { var cow = cows.Where(c => c.UserName == result.Rival.Name).FirstOrDefault(); if (cow == null) { if (result.Win) { cow = new Cow { UserID = result.Rival.UserID, UserName = result.Rival.Name, Level = result.Rival.Level, AverageBenefit = result.Money, LastBenefit = result.Money, MilkingCount = 1, Cristals = result.Crystals, RivalInjuryHealth = result.RivalInjuryHealth, RivalHealth = result.RivalHealth, UserType = UserType.Cow }; cows.Add(cow); cow.GoRest(); } } else { if (result.Win) { cow.MilkingCount++; cow.RivalInjuryHealth = result.RivalInjuryHealth; cow.RivalHealth = result.RivalHealth; cow.Cristals += result.Crystals; cow.AverageBenefit = (cow.AverageBenefit + result.Money) / 2; cow.LastBenefit = result.Money; cow.GoRest(); } else { cows.Remove(cow); } } }
private void InitFightInfo() { _FightGuestPlans.Clear(); _WaveGuests.Clear(); _EnemyGirls.Clear(); foreach (var objPlan in _FightRecord.ObjPlan) { if (objPlan == null) { continue; } if (string.IsNullOrEmpty(objPlan.TableName)) { continue; } var planBase = (FightObjPlan_Base)Activator.CreateInstance(Type.GetType("GameLogic." + objPlan.TableName)); planBase.Init(objPlan.ID); _FightGuestPlans.Add(planBase); _EnemyGirls.Add(planBase.GetEnemyGirl()); _WaveGuests.Add(planBase.GetGuest()); Debug.Log("guestWave:" + _WaveGuests.Count + ", count:" + _WaveGuests[_WaveGuests.Count - 1].Id); } _FightingWave = -1; Debug.Log("_EnemyGirls:" + _EnemyGirls.Count); EnemyPlayer = new FightObj_Player(); EnemyPlayer.Init(); SelfPlayer = new FightObj_Player(); SelfPlayer.Init(); _FightResult = new FightResult(); InitNextRound(); ClearAllGirlCD(); }
public override IEnumerator ExecuteAction(FightingEntity user, List <FightingEntity> targets, BattleFight battleFight) { _battleFight = battleFight; FightResult result = new FightResult(user, this); if (CheckCost(user)) { PayCost(user); ActionBase selectedAction = _actions[Random.Range(0, _actions.Length)]; targets = selectedAction.GetNewTargets(user); // Play animation yield return(GameManager.Instance.time.GetController().StartCoroutine(selectedAction.PlayAnimation(user, targets))); result = selectedAction.ApplyEffect(user, targets); OnPostEffect(result); _battleFight.EndFight(result, this); yield return(GameManager.Instance.time.GetController().WaitForSeconds(selectedAction.animation.GetAnimCooldown())); } }
public async Task <FightResult> Fight(IEnumerable <string> queries) { if (queries.Count() < 2) { throw new InvalidOperationException("Should be more than 1 element to compare"); } var result = new FightResult(); foreach (var query in queries) { var queryResult = await FindEntries(query); result.QueryResults.Add(queryResult); } result.Winners = GetWinners(result.QueryResults); var totalWinner = result.Winners.OrderByDescending(_ => _.Entries).FirstOrDefault(); result.TotalWinner = totalWinner?.Query; return(result); }
/// <summary> /// /// </summary> void Start() { tmpstr = typeof(FightInrto).ToString(); FightInrto introp = new FightInrto(this, tmpstr); procMgr.Add(tmpstr, introp); tmpstr = typeof(FightReady).ToString(); FightReady readyp = new FightReady(this, tmpstr); procMgr.Add(tmpstr, readyp); tmpstr = typeof(FightGame).ToString(); FightGame gamep = new FightGame(this, tmpstr); procMgr.Add(tmpstr, gamep); tmpstr = typeof(FightPowerUp).ToString(); FightPowerUp powp = new FightPowerUp(this, tmpstr); procMgr.Add(tmpstr, powp); tmpstr = typeof(FightFinish).ToString(); FightFinish fishp = new FightFinish(this, tmpstr); procMgr.Add(tmpstr, fishp); tmpstr = typeof(FightResult).ToString(); FightResult resp = new FightResult(this, tmpstr); procMgr.Add(tmpstr, resp); tmpstr = typeof(FightWarning).ToString(); FightWarning wrnp = new FightWarning(this, tmpstr); procMgr.Add(tmpstr, wrnp); procMgr.SetCurrProc("FightInrto"); }