private void OnTriggerExit2D(Collider2D collision) { //if (isLock) //{ // return; //} if (IsEnemy(collision.gameObject.tag)) { switch (collision.name) { case rangName: attackModel = AttackModel.none; FindNewTarget(); break; case minRangName: attackModel = AttackModel.longRange; break; case closeCombatRangeName: if (minRangShare) { attackModel = AttackModel.longRange; } else { attackModel = AttackModel.none; FindNewTarget(); } break; } } }
public static IEnumerator AttackCompute(bool isPLayer, AttackModel attack) { yield return(CharacterLogic.ActivateCharacters()); yield return(ScreenBattleController.Instance.partState.StartBattleAnimation(isPLayer, attack.attackDamage, delegate() { PlayerManager.SetIsPlayer(!isPLayer); if (isPLayer) { Debug.Log("BEFORE ENEMY HP: " + PlayerManager.Player.hp); } else { Debug.Log("BEFORE PLAYER HP: " + PlayerManager.Player.hp); } PlayerManager.Player.hp -= attack.attackDamage; if (isPLayer) { Debug.Log("PLAYER DAMAGE: " + attack.attackDamage); Debug.Log("NOW ENEMY HP: " + PlayerManager.Player.hp); } else { Debug.Log("ENEMY DAMAGE: " + attack.attackDamage); Debug.Log("NOW PLAYER HP: " + PlayerManager.Player.hp); } PlayerManager.UpdateStateUI(!isPLayer); })); }
public void OnNotify(Firebase.Database.DataSnapshot dataSnapShot) { try { Dictionary <string, System.Object> rpcReceive = (Dictionary <string, System.Object>)dataSnapShot.Value; if (rpcReceive.ContainsKey(MyConst.RPC_DATA_PARAM)) { bool userHome = (bool)rpcReceive [MyConst.RPC_DATA_USERHOME]; Dictionary <string, System.Object> param = (Dictionary <string, System.Object>)rpcReceive [MyConst.RPC_DATA_PARAM]; if (param.ContainsKey(MyConst.RPC_DATA_ATTACK)) { AttackModel attack = JsonUtility.FromJson <AttackModel> (param [MyConst.RPC_DATA_ATTACK].ToString()); if (userHome.Equals(GameManager.isHost)) { playerAttack = attack; } else { enemyAttack = attack; } } } } catch (System.Exception e) { //do something later } }
/// <summary> /// Creates an instance of <see cref="AttackModel"/> /// </summary> public AttackViewModel(AttackModel attackModel) { _attackModel = attackModel; _abilities.Add(new KeyValuePair <Ability, string>(Ability.None, "None")); foreach (Tuple <string, Ability> ability in _statService.Abilities) { _abilities.Add(new KeyValuePair <Ability, string>(ability.Item2, ability.Item1)); } _selectedAbility = _abilities.FirstOrDefault(x => x.Key == attackModel.Ability); _damageTypes.Add(new KeyValuePair <DamageType, string>(DamageType.None, "None")); foreach (KeyValuePair <DamageType, string> damageType in _statService.DamageTypes) { _damageTypes.Add(new KeyValuePair <DamageType, string>(damageType.Key, damageType.Value)); } _selectedDamageType = _damageTypes.FirstOrDefault(x => x.Key == attackModel.DamageType); _dice.AddRange(_statService.Dice); if (String.IsNullOrWhiteSpace(_attackModel.DamageDie)) { _attackModel.DamageDie = _dice[0]; } }
private void OnTriggerStay2D(Collider2D collision) { if (!isLock && perFrameDetection) { if (IsEnemy(collision.gameObject.tag)) { switch (collision.name) { case rangName: attackModel = AttackModel.longRange; FindTarget(collision.gameObject); break; case minRangName: if (minRangShare) { attackModel = AttackModel.closeCombat; FindTarget(collision.gameObject); } else { attackModel = AttackModel.none; } break; case closeCombatRangeName: attackModel = AttackModel.closeCombat; FindTarget(collision.gameObject); break; } perFrameDetection = false; } } }
public Censor(List <Distributor> distributors, AttackModel attackModel, double blockProbability, int seed) { this.distributors = distributors; AttackModel = attackModel; BlockingProbability = blockProbability; (distributors[0] as LeaderDistributor).OnYield += OnDistYield; randGen = new Random(seed); // The seed must be different from distributor's RNG seed }
public Censor(List<Distributor> distributors, AttackModel attackModel, double blockProbability, int seed) { this.distributors = distributors; AttackModel = attackModel; BlockingProbability = blockProbability; (distributors[0] as LeaderDistributor).OnYield += OnDistYield; randGen = new Random(seed); // The seed must be different from distributor's RNG seed }
/// <summary> /// Applies the given ModDisplay to the index'th (or first) DisplayModel in the behaviors of the AttackModel. /// <br/> /// If there are no DisplayModels, then this does nothing /// </summary> /// <param name="attackModel"></param> /// <param name="index"></param> /// <typeparam name="T"></typeparam> public static void ApplyDisplay <T>(this AttackModel attackModel, int index = 0) where T : ModDisplay { var displayModels = attackModel.GetBehaviors <DisplayModel>(); if (displayModels.Count > 0 && index >= 0 && index < displayModels.Count) { displayModels[index].ApplyDisplay <T>(); } }
public void AttackPhase(AttackModel param) { SetParam(MyConst.RPC_DATA_ATTACK, (param)); GetLatestKey(2, delegate(string resultString) { FirebaseDBFacade.RunTransaction(reference.Child(MyConst.GAMEROOM_ROOM).Child(gameRoomKey).Child(MyConst.GAMEROOM_BATTLE_STATUS).Child(resultString), delegate(MutableData mutableData) { mutableData.Value = PhaseMutate(mutableData, MyConst.BATTLE_STATUS_ATTACK); }); }); }
public void AttackPhase(AttackModel param) { ScreenController.Instance.StartWaitOpponentScreen(); GetLatestKey(3, delegate(string resultString) { FDFacade.Instance.RunTransaction(reference.Child(MyConst.GAMEROOM_NAME).Child(gameRoomKey).Child(MyConst.GAMEROOM_BATTLE_STATUS).Child(resultString), delegate(MutableData mutableData) { mutableData.Value = PhaseMutate(mutableData, MyConst.BATTLE_STATUS_ATTACK, delegate(Dictionary <string, System.Object> battleStatus, int battleCount) { SetAttackParam(param); }); }); }); }
public ActionResult AttemptAttack(ApiVersion version, [FromBody] AttackModel model) { try { var status = _attacker.Attack(model.Board, model.Row, model.Column); return(Ok(status)); } catch (Exception e) { Console.WriteLine(e); throw; } }
public void Attack(AttackModel attackInfo) { _currentCreature = _creaturesComponent.SingleOrDefault(x => x.Index == attackInfo.SenderCreatureIndex); var target = _creaturesComponent.SingleOrDefault(x => x.Index == attackInfo.TargetCreatureIndex); ExecuteOnMainThread.Enqueue(() => { _currentCreature.behavior.Damage = attackInfo.Damage; _currentCreature.behavior.Target = target.gameObject; _currentCreature.Attack(); _currentCreature.behavior.Attack(_currentCreature.transform.position); _currentCreature._anim.SetFloat("attack", 1); }); }
private void UpdateConfig() { AttackModel attackModel = new AttackModel { Boss = (bool)BossBattle.IsChecked, Friend = (bool)FriendBattle.IsChecked, Guild = (bool)GuildBattle.IsChecked, Brave = (bool)BraveBattle.IsChecked, DoS = (bool)DoSBattle.IsChecked, Expedition = (bool)ExpeditionBattle.IsChecked, PlanetTrial = (bool)PlanetTrialBattle.IsChecked, PlanetTrialRetryAmount = Convert.ToInt32(PlanetTrialRetry.Text), PlanetTrialAutoRetry = (bool)PlanetTrialAutoRetry.IsChecked, BraveMaxTickets = Convert.ToInt32(BraveMaxTickets.Text), BraveMaxCE = Convert.ToInt32(BraveMaxCE.Text), BraveAutoRetry = (bool)BraveAttackMore.IsChecked, GuildRetryAmount = Convert.ToInt32(GuildMax.Text), FriendRetryAmount = Convert.ToInt32(FriendRetry.Text), FriendMaxOnly = (bool)FriendMax.IsChecked }; GlobalVariables.attackSettings = attackModel; DailyModel dailyModel = new DailyModel { Alchemy = (bool)Alchemy.IsChecked, SendHearts = (bool)SendHearts.IsChecked, SpinWheel = (bool)SpinWheel.IsChecked, DailyTavern = (bool)CompleteTavern.IsChecked, CombineEquip = (bool)CombineEquip.IsChecked, CommonSummon = (bool)PerformCommon.IsChecked, GrandSummon = (bool)PerformGrand.IsChecked, DailyBrave = (bool)CompleteBrave.IsChecked, SendFriendReq = (bool)SendFriend.IsChecked, AcceptFreindReq = (bool)AcceptFriends.IsChecked, DeclineFriendReq = (bool)DeclineFriends.IsChecked, DailyBag = (bool)DailyBag.IsChecked, PurchaseDoSTicket = (bool)PurchaseDoS.IsChecked, DeleteMail = (bool)DeleteMail.IsChecked }; WriteIni.UpdateConfig(attackModel, dailyModel); }
// Thanks to doombubbles for creating this /// <summary> /// Recursively get all ProjectileModels for this attack model and all of it's weapons /// </summary> /// <param name="attackModel"></param> /// <returns></returns> public static List <ProjectileModel> GetAllProjectiles(this AttackModel attackModel) { List <ProjectileModel> allProjectiles = new List <ProjectileModel>(); foreach (var weaponModel in attackModel.weapons) { if (weaponModel.projectile != null) { allProjectiles.Add(weaponModel.projectile); allProjectiles.AddRange(GetSubProjectiles(weaponModel.projectile.behaviors)); } allProjectiles.AddRange(GetSubProjectiles(weaponModel.behaviors)); } allProjectiles.AddRange(GetSubProjectiles(attackModel.behaviors)); //this is new return(allProjectiles); }
public ArmyEventReportBuilder WithNotification(AttackModel attack) { var strBuilder = new StringBuilder(); strBuilder.AppendLine(ReportText); //strBuilder.AppendLine($"Village [{armyEvent.UserVillage}] is under attack."); strBuilder.AppendLine($"The attack date time: [{attack.DateTime.ToDisplayStringApplyTimeZone(timezone)}]"); strBuilder.AppendLine($"The attack intruder details: [{attack.IntruderVillageUrl}]"); if (attack.FromVillage != null) { strBuilder.AppendLine($"The intruder: [{attack.FromVillage.PlayerName}]"); strBuilder.AppendLine($"The intruder village: [{attack.FromVillage.VillageName} [{attack.FromVillage.CoordinateX}|{attack.FromVillage.CoordinateY}]"); strBuilder.AppendLine($"The intruder Alliance: [{attack.FromVillage.Alliance}]"); } ReportText = strBuilder.ToString(); return(this); }
private static bool AttackBattles() { AttackModel AS = GlobalVariables.attackSettings; if (AS.Boss) { Attack.HomeBossAttackHandler(); } if (AS.Friend) { Main.LogConsole("Skipping Friend Attack..."); } if (AS.Guild) { Main.LogConsole("Skipping Friend Attack..."); } if (AS.DoS) { Attack.DenOfSecretAttackHandler(); } if (AS.Expedition) { Main.LogConsole("Skipping Expedition.."); } if (AS.PlanetTrial && (AS.PlanetTrialAutoRetry || !Main.CheckSameDay(GlobalVariables.LAST_RAN))) { Attack.PlanetTrialAttackHandler(); } if (AS.Brave && (AS.BraveAutoRetry || !Main.CheckSameDay(GlobalVariables.LAST_RAN))) { Attack.BraveAttackHandler(); } return(true); }
/// <summary> /// Shows create attack dialog /// </summary> public AttackModel ShowCreateAttackDialog(string title, AttackModel attackModel) { ModalDialog modalDialog = new ModalDialog(); if (_parentWindow != null) { modalDialog.Owner = _parentWindow; } AttackModel attackModelCopy = new AttackModel(attackModel); CreateAttackView createAttackView = new CreateAttackView(new AttackViewModel(attackModelCopy)); modalDialog.WindowTitle = title; modalDialog.Body = createAttackView; modalDialog.Confirmation = createAttackView.ViewModel; bool?result = ShowDialog(modalDialog); return(result == true ? attackModelCopy : null); }
public IActionResult Attack(AttackModel attackModel) { try { string username = GetCurrentUserName(); var result = _battleshipGameService .Attack(username, attackModel.Position); return(ResponseMessageHelper.Ok(result.ToString())); } catch (BattleshipGameException ex) { return(ResponseMessageHelper.BadRequest(ex.Message)); } catch (Exception ex) { //write exception to a error log return(ResponseMessageHelper.InternalServerError()); } }
protected virtual void Awake() { //distribution du bonus d'initiative auto switch (type) { case "Rogue": initBonus = 15; break; case "Mage": initBonus = 10; break; case "Warrior": initBonus = 5; break; default: initBonus = 0; break; } if (currentHP <= 0) { currentHP = 100f; } //currentAp = DataContainer.singleton.globalAP.apInfo.maxAp; AttackModel coupDeGriffe = new AttackModel("coupDeGriffe", 1, Vector2.zero, 3f, 5); coupDeGriffe.AddEffect(new Effects(0, 3, 0, 0, 30, 1)); //GetAttacks() }
private void GetAttackPropertiesSelectedId(AttackModel attackModel) { AttackPropertiesSelectedId = attackModel.AttackProperties.Select(x => x.Id).ToList(); }
public void SetAttackParam(AttackModel attack) { SetParam(attack.ToDictionary()); }
/// <summary> /// Add a weapon to this Attack Model /// </summary> /// <param name="weaponToAdd">Weapon to add</param> public static void AddWeapon(this AttackModel attackModel, WeaponModel weaponToAdd) => attackModel.weapons = attackModel.weapons.AddTo(weaponToAdd);
// Start is called before the first frame update void Awake() { AttackModel attack1 = new AttackModel("le sboui", 666, Vector2.zero, 0f, 666); attack1.AddEffect(new Effects()); }
public static void ClearBattleData() { characterActionCounter = 0; playerAttack = null; enemyAttack = null; }
/// <summary> /// (Cross-Game compatible) Remove a weapon from this Attack Model /// </summary> /// <param name="attackModel"></param> /// <param name="weaponToRemove"></param> public static void RemoveWeapon(this AttackModel attackModel, WeaponModel weaponToRemove) => attackModel.weapons = attackModel.weapons.RemoveItem(weaponToRemove);
public static void AddBehavior <T>(this AttackModel model, T behavior) where T : Model { model.behaviors = model.behaviors.AddTo(behavior); }
public static List <T> GetBehaviors <T>(this AttackModel model) where T : Model { return(model.behaviors.GetItemsOfType <Model, T>()); }
public static void UpdateConfig(AttackModel attackModel, DailyModel dailyModel) { var IniFile = "BotConfig.Ini"; var parser = new IniDataParser(); IniData parsedData; using (FileStream fs = File.Open(IniFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using (StreamReader sr = new StreamReader(fs, System.Text.Encoding.UTF8)) { parsedData = parser.Parse(sr.ReadToEnd()); } } // Modify the loaded ini file //General Header parsedData["General"]["version"] = "1.0"; parsedData["General"]["Bot Last Ran"] = GlobalVariables.LAST_RAN.ToString(); parsedData["General"]["Player Last"] = "0"; //parsedData["General"]["Bot Last Ran"] = DateTime.Now.ToString(); parsedData["Battle"]["Boss Battle"] = attackModel.Boss.ToString(); parsedData["Battle"]["Friend Battle"] = attackModel.Friend.ToString(); parsedData["Battle"]["Guild Battle"] = attackModel.Guild.ToString(); parsedData["Battle"]["Brave Battle"] = attackModel.Brave.ToString(); parsedData["Battle"]["DoS Battle"] = attackModel.DoS.ToString(); parsedData["Battle"]["Expedition Battle"] = attackModel.Expedition.ToString(); parsedData["Battle"]["Planet Trial Battle"] = attackModel.PlanetTrial.ToString(); parsedData["Battle Extra"]["Planet Trial Retry"] = attackModel.PlanetTrialRetryAmount.ToString(); parsedData["Battle Extra"]["Planet Trial Auto Retry"] = attackModel.PlanetTrialAutoRetry.ToString(); parsedData["Battle Extra"]["Brave Max Tickets"] = attackModel.BraveMaxTickets.ToString(); parsedData["Battle Extra"]["Brave Max CE"] = attackModel.BraveMaxCE.ToString(); parsedData["Battle Extra"]["Brave Auto Retry"] = attackModel.BraveAutoRetry.ToString(); parsedData["Battle Extra"]["Guild Retry"] = attackModel.GuildRetryAmount.ToString(); parsedData["Battle Extra"]["Friend Retry"] = attackModel.FriendRetryAmount.ToString(); parsedData["Battle Extra"]["Friend Auto Retry"] = attackModel.FriendMaxOnly.ToString(); parsedData["Daily"]["Alchemy"] = dailyModel.Alchemy.ToString(); parsedData["Daily"]["Send Hearts"] = dailyModel.SendHearts.ToString(); parsedData["Daily"]["Spin Wheel"] = dailyModel.SpinWheel.ToString(); parsedData["Daily"]["Daily 2 Tavern"] = dailyModel.DailyTavern.ToString(); parsedData["Daily"]["Combine Equipments"] = dailyModel.CombineEquip.ToString(); parsedData["Daily"]["Common Summon"] = dailyModel.CommonSummon.ToString(); parsedData["Daily"]["Grand Summon"] = dailyModel.GrandSummon.ToString(); parsedData["Daily"]["Daily Brave League"] = dailyModel.DailyBrave.ToString(); parsedData["Daily Extra"]["Send Friend Requests"] = dailyModel.SendFriendReq.ToString(); parsedData["Daily Extra"]["Accept Friend Requests"] = dailyModel.AcceptFreindReq.ToString(); parsedData["Daily Extra"]["Decline Friend Requests"] = dailyModel.DeclineFriendReq.ToString(); parsedData["Daily Extra"]["Claim Free Gift Bad"] = dailyModel.DailyBag.ToString(); parsedData["Daily Extra"]["Purchase DoS Tickets"] = dailyModel.PurchaseDoSTicket.ToString(); parsedData["Daily Extra"]["Delete Mail"] = dailyModel.DeleteMail.ToString(); var fileparser = new FileIniDataParser(); fileparser.WriteFile(IniFile, parsedData); }
public static void RemoveBehavior <T>(this AttackModel model, T behavior) where T : Model { model.behaviors = model.behaviors.RemoveItem(behavior); }
public static void RemoveBehaviors <T>(this AttackModel model) where T : Model { model.behaviors = model.behaviors.RemoveItemsOfType <Model, T>(); }
public static void ReadFile() { var IniFile = "BotConfig.Ini"; try { var parser = new FileIniDataParser(); IniData data = parser.ReadFile(IniFile); GlobalVariables.LAST_RAN = DateTime.Parse(data["General"]["Bot Last Ran"]); GlobalVariables.CURRENCY_INFO[2] = Convert.ToInt32(data["General"]["Player Level"]); AttackModel attackModel = new AttackModel { Boss = Boolean.Parse(data["Battle"]["Boss Battle"]), Friend = Boolean.Parse(data["Battle"]["Friend Battle"]), Guild = Boolean.Parse(data["Battle"]["Guild Battle"]), Brave = Boolean.Parse(data["Battle"]["Brave Battle"]), DoS = Boolean.Parse(data["Battle"]["DoS Battle"]), Expedition = Boolean.Parse(data["Battle"]["Expedition Battle"]), PlanetTrial = Boolean.Parse(data["Battle"]["Planet Trial Battle"]), PlanetTrialRetryAmount = Convert.ToInt32(data["Battle Extra"]["Planet Trial Retry"]), PlanetTrialAutoRetry = Boolean.Parse(data["Battle Extra"]["Planet Trial Auto Retry"]), BraveMaxTickets = Convert.ToInt32(data["Battle Extra"]["Brave Max Tickets"]), BraveMaxCE = Convert.ToInt32(data["Battle Extra"]["Brave Max CE"]), BraveAutoRetry = Boolean.Parse(data["Battle Extra"]["Brave Auto Retry"]), GuildRetryAmount = Convert.ToInt32(data["Battle Extra"]["Guild Retry"]), FriendRetryAmount = Convert.ToInt32(data["Battle Extra"]["Friend Retry"]), FriendMaxOnly = Boolean.Parse(data["Battle Extra"]["Friend Auto Retry"]) }; GlobalVariables.attackSettings = attackModel; DailyModel dailyModel = new DailyModel { Alchemy = Boolean.Parse(data["Daily"]["Alchemy"]), SendHearts = Boolean.Parse(data["Daily"]["Send Hearts"]), SpinWheel = Boolean.Parse(data["Daily"]["Spin Wheel"]), DailyTavern = Boolean.Parse(data["Daily"]["Daily 2 Tavern"]), CombineEquip = Boolean.Parse(data["Daily"]["Combine Equipments"]), CommonSummon = Boolean.Parse(data["Daily"]["Common Summon"]), GrandSummon = Boolean.Parse(data["Daily"]["Grand Summon"]), DailyBrave = Boolean.Parse(data["Daily"]["Daily Brave League"]), SendFriendReq = Boolean.Parse(data["Daily Extra"]["Send Friend Requests"]), AcceptFreindReq = Boolean.Parse(data["Daily Extra"]["Accept Friend Requests"]), DeclineFriendReq = Boolean.Parse(data["Daily Extra"]["Decline Friend Requests"]), DailyBag = Boolean.Parse(data["Daily Extra"]["Claim Free Gift Bad"]), PurchaseDoSTicket = Boolean.Parse(data["Daily Extra"]["Purchase DoS Tickets"]), DeleteMail = Boolean.Parse(data["Daily Extra"]["Delete Mail"]) }; GlobalVariables.dailySettings = dailyModel; } catch { Main.LogConsole("Error Reading Config! Reseting Config...."); File.Delete("BotConfig.ini"); WriteIni.WriteConfig(); } }
public static bool HasBehavior <T>(this AttackModel model) where T : Model { return(model.behaviors.HasItemsOfType <Model, T>()); }