/// <summary> /// Called when the buff is destroyed. /// </summary> public override void OnDestroy() { if (GameControl.control.talente[3]) { if (jumpsLeft > 0) { List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth(); raiderDict.Remove(GetRaider()); int countRaider = raiderDict.Count; for (int i = 0; i < countRaider; i++) { Raider target = raiderDict.First(); if (!target.GetGameObject().GetComponent <RenewHot>()) { target = raiderDict.First(); RenewHot buff = target.GetGameObject().AddComponent <RenewHot>(); buff.jumpsLeft = jumpsLeft - 1; break; } raiderDict.Remove(target); } } } }
public void PostNewRaider(Action <string> OnSuccess = null, Raider newRaider = null) { string newRaiderString = JsonManager.SerializeToJson <Raider>(newRaider); string url = phpFilesServer + "GenerateNewRaider.php"; WebController.s_Instance.PostWebRequest(url, OnSuccess, new WebRequest.FormField("newRaider", newRaiderString)); }
public ActionResult Create(FormCollection collection) { try { var classe = Request.Form["Classe"]; var specialisation = Request.Form["Specialisation"]; var nom = Request.Form["Nom"]; if (classe == "0" || specialisation == "0" || nom == "") { ViewBag.Commentaire = nom == "" ? "Vous devez tout d'abord entrer un nom pour le raider." : classe == "0" ? "Vous devez choisir une classe pour le raider" : specialisation == "0" ? "Vous devez sélectionner une spécialisation pour le raider." : ""; ViewBag.NomChoisi = nom; return(View("Create")); } // Variables du formulaire var classId = (int)(Classes)Enum.Parse(typeof(Classes), classe); var specializationId = (int)(Specializations)Enum.Parse(typeof(Specializations), specialisation); // Ajout du nouvel élément dans la base de données var newRaider = new Raider { Id = db.Raiders.Count(), Nom = nom, ClassId = classId, SpecializationId = specializationId, Joined = DateTime.Now }; db.Raiders.Add(newRaider); // Enregistrer les changements dans la base de données db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public override float ComputeRating() { var self = Raider.Self; int selfHits = (int)Math.Ceiling(self.Life / DMG_PER_HIT); var victim = Raider.GetClosestEnemy(); int victimHits = (int)Math.Ceiling(victim.Life / DMG_PER_HIT); float distanceToVictim = Raider.DistanceToNextEnemy(); if (distanceToVictim <= 2 && selfHits < victimHits) { return(NULL_RATING); } if (distanceToVictim > 2 && selfHits <= victimHits) { return(NULL_RATING); } if (distanceToVictim == 1) { return(OVERRIDE_RATING); } bool wontHeal = distanceToVictim < Raider.DistanceToTavernFrom(victim.Position); return(base.ComputeRating() * (wontHeal ? 1 : 0.5f) * Sigmoid(MEDIAN_DISTANCE - distanceToVictim)); }
/// <summary> /// Called when the buff is destroyed. /// Decreases jumps by 1 and applies the buff to another raider. /// </summary> public void Jump() { GetRaider().Heal(HEALAMOUNT); if (jumpsLeft > 0) { List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth(); raiderDict.Remove(GetRaider()); int countRaider = raiderDict.Count; for (int i = 0; i < countRaider; i++) { Raider target = raiderDict.First(); if (!target.GetGameObject().GetComponent <PrayerBuff>()) { target = raiderDict.First(); PrayerBuff buff = target.GetGameObject().AddComponent <PrayerBuff>(); buff.jumpsLeft = jumpsLeft - 1; break; } raiderDict.Remove(target); } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Space(); EditorGUILayout.Space(); DBController dbController = (DBController)target; #region Database functionalities //Post New Raider username = EditorGUILayout.TextField("Username:"******"Password:"******"Name:", raiderName); mainClass = (Class)EditorGUILayout.EnumPopup("Main Class:", mainClass); mainSpec = (Spec)EditorGUILayout.EnumPopup("Main Spec:", mainSpec); offSpec = (Spec)EditorGUILayout.EnumPopup("Off Spec:", offSpec); if (GUILayout.Button("Post New Raider")) { Raider newRaider = new Raider(0, username, password, raiderName, mainSpec, offSpec, mainClass); dbController.PostNewRaider((result) => { if (WebResponse.isResultOk(result)) { MainController.s_Instance.rosterController.OnPostNewRaider(); } Debug.Log("Post New Raider: " + result); }, newRaider); } if (GUILayout.Button("Post New Roster")) { dbController.GenerateNewCustomRoster((result) => { Debug.Log("Post New Roster: " + result); }); } //dbController.PostNewRoster((result) => { Debug.Log(result); }); if (GUILayout.Button("Post New Clean Month")) { dbController.PostNewCleanMonth((result) => { Debug.Log("Post New Clean Month: " + result); }); } GUILayout.Space(20f); if (GUILayout.Button("Restart DB")) { dbController.ResetDB(); } if (GUILayout.Button("Clean DB")) { dbController.GetCleanDatabase((result) => { Debug.Log("Clean DB: " + result); }); } GUILayout.Space(20f); if (GUILayout.Button("GetTest")) { dbController.GetTest((result) => { Debug.Log("Get Test: " + result); }); } if (GUILayout.Button("PostTest")) { dbController.PostTest((result) => { Debug.Log("Post Test: " + result); }); } GUILayout.Space(20f); #endregion }
public override void OnDoubleClick(Mobile from) { if (IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1152244); // What would you like to arrest? from.BeginTarget(10, false, TargetFlags.None, (m, targeted) => { if (targeted is Raider) { Raider raider = targeted as Raider; if (raider.InRange(m.Location, 1)) { if (raider.TryArrest(from)) { Delete(); } } else { m.SendLocalizedMessage(1152242); // You cannot reach that. } } else { m.SendLocalizedMessage(1152243); // You cannot arrest that. } }); } else { from.SendLocalizedMessage(1116249); // That must be in your backpack for you to use it. } }
/// <summary> /// Creates the heal text. /// </summary> /// <param name="position">The position.</param> /// <param name="raider">The raider.</param> /// <param name="amount">The Heal amount.</param> public void CreateHealText(Vector3 position, Raider raider, float amount) { GameObject text = (GameObject)Instantiate(dmgTextPrefab, position, Quaternion.identity); text.transform.SetParent(raider.GetGameObject().GetComponentInChildren <Canvas>().transform); text.GetComponent <CombatText>().Initialize(new Vector3(0.15f, 0.5f, -1), new Color32(0, 255, 0, 255), amount.ToString("F0")); }
public override void Initialize() { recScreen = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); positionStart = new Vector2(0, -1 * (recScreen.Height)); recStart = new Rectangle((int)positionStart.X, (int)positionStart.Y, recScreen.Width, recScreen.Height); recLeftSide = new Rectangle(0, -1500, recScreen.Width / 4, 3000); recRightSide = new Rectangle(recScreen.Width - (recScreen.Width / 4), -1500, recScreen.Width / 4, 3000); recB2 = new Rectangle(0, (int)positionStart.Y, recScreen.Width / 2, recScreen.Height / 2); recB3 = new Rectangle(recScreen.Width / 2, (int)positionStart.Y, recScreen.Width / 2, recScreen.Height / 2); recB4 = new Rectangle(recScreen.Width / 2, (int)positionStart.Y / 2, recScreen.Width / 2, recScreen.Height / 2); recB5 = new Rectangle(0, (int)positionStart.Y / 2, recScreen.Width / 2, recScreen.Height / 2); jet = new Jet(Game.Content.Load <Texture2D>("gameplay/jet1"), new Vector2(recScreen.Width / 2, 0), 65, 36); ship = new Ship(Game.Content.Load <Texture2D>("gameplay/ship1"), new Vector2(recScreen.Width / 2, 400), 99, 35); heli = new Heli(Game.Content.Load <Texture2D>("gameplay/heli"), new Vector2(recScreen.Width / 2, 800), 65, 37); raider = new Raider(Game.Content.Load <Texture2D>("gameplay/raider1"), new Vector2((recScreen.Width / 2) - 100, recScreen.Height / 2 + 400), 50, 53); background = new Background(Game.Content.Load <Texture2D>("gameplay/background"), recScreen); backgroundA = new Background(Game.Content.Load <Texture2D>("gameplay/background1"), new Rectangle(0, 0, recScreen.Width, recScreen.Height)); backgroundB = new Background(Game.Content.Load <Texture2D>("gameplay/background2"), recStart); backgroundC = new Background(Game.Content.Load <Texture2D>("gameplay/background3"), recStart); backgroundD = new Background(Game.Content.Load <Texture2D>("gameplay/background4"), recStart); backgroundE = new Background(Game.Content.Load <Texture2D>("gameplay/background5"), recStart); }
public static Raider LoadRaiderFromDBJson(string jsonInformation) { Debug.Log(jsonInformation); Raider newRaider = JsonManager.DeserializeFromJson <Raider>(jsonInformation); return(newRaider); }
/// <summary> /// Deregisters a raider. /// </summary> /// <param name="raider">The raider.</param> public void DeRegisterRaider(Raider raider) { if (raiderDict.Contains(raider)) { raiderDict.Remove(raider); } }
/// <summary> /// Attempts to place a ship of type in DRADIS location /// </summary> /// <param name="location"></param> /// <param name="type"></param> /// <returns>The component that has been placed</returns> public BaseComponent PlaceComponent(DradisNodeName location, ComponentType type) { AddToTurnLog("A " + type + " arrives in " + location + "!"); BaseComponent ship = null; switch (type) { case ComponentType.Basestar: ship = new Basestar(); break; case ComponentType.Civilian: ship = DrawCiv(); break; case ComponentType.HeavyRaider: ship = new HeavyRaider(); break; case ComponentType.Raider: ship = new Raider(); break; case ComponentType.Viper: ship = DrawViper(); break; } CurrentGameState.Dradis.AddComponentToNode(ship, location); return(ship); }
/// <summary> /// Called on every fixed update. /// </summary> void FixedUpdate() { swingTimerCurrent += 0.02f; if (swingTimerCurrent > swingTimer - 2.05f && swingTimerCurrent < swingTimer - 1.95f) { GetComponent <Boss>().SetEmoteText(" " + emoteText); } cooldownOverlay.fillAmount = swingTimerCurrent / swingTimer; if (swingTimerCurrent >= swingTimer) { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs()); if (target != null && targetDict.Count > 1) { targetDict.Remove(target); } if (targetDict.Count == 0) { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders()); } target = targetDict[Random.Range(0, targetDict.Count)]; target.GetGameObject().AddComponent <MarkDebuff>(); swingTimerCurrent = 0f; } }
/// <summary> /// Called on every fixed update, selects a target randomly and damages it. /// If atleast one dd is alive, select one at random, else select a tank. /// </summary> void FixedUpdate() { if (!Gamestate.gamestate.GetPaused()) { swingTimerCurrent += 0.02f; if (swingTimerCurrent >= swingTimer) { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllDDs()); int numberTargets = targetDict.Count; if (numberTargets <= 0) //no dd is alive, load all raider { targetDict = new List <Raider>(RaiderDB.GetInstance().GetAllRaiders()); numberTargets = targetDict.Count; } if (target != null && targetDict.Count > 1 && targetDict.Contains(target)) { targetDict.Remove(target); } target = targetDict[Random.Range(0, targetDict.Count)]; target.Damage(dmg); dmg += multiplieer; swingTimerCurrent = 0f; } } }
/// <summary> /// Called when a cast is sucesfully finished. /// Applys the guardian spirit buff to the current target. /// Applys the guardian spirit invis buff to every other raider if the talent is selected. /// </summary> public override void OnCastSucess() { Raider target = GetTarget(); if (!target.GetGameObject().GetComponent <GuardianSpiritBuff>()) //check if target allready has the buff { GuardianSpiritBuff buff = target.GetGameObject().AddComponent <GuardianSpiritBuff>(); //apply new buff } else { target.GetGameObject().GetComponent <GuardianSpiritBuff>().Reset(); //refresh old buff } if (GameControl.control.talente[8]) //apply invis buff to every other raider if talent is picked { List <Raider> raiderDict = RaiderDB.GetInstance().GetAllRaidersSortedByHealth(); raiderDict.Remove(target); foreach (Raider raider in raiderDict) { GuardianSpiritBuffInvis buff = raider.GetGameObject().AddComponent <GuardianSpiritBuffInvis>(); } } }
public void PostUpdateRaider(Action <string> OnSuccess = null, Raider newRaider = null) { //ToDo: This could be splited into more methods to only update the changed variable, not the whole raider string newRaiderString = JsonManager.SerializeToJson <Raider>(newRaider); string url = phpFilesServer + "UpdateRaider.php"; WebController.s_Instance.PostWebRequest(url, (result) => { print(result + "raiderName" + newRaider.name); }, new WebRequest.FormField("newRaider", newRaiderString)); }
public void CustomLoadRaiders() { Raider raider = new Raider(0, "Bronto", Raider.Spec.DPS); raiders.Add(raider); auxRaider = raider; raider = new Raider(1, "Burbu", Raider.Spec.Heal); raiders.Add(raider); }
public Raid(BattleManager mgr, Raider player, RaidSize _size) { Mgr = mgr; Size = _size; Raiders = new List <Entity>(); BuildRaid(player); }
async Task ReactionAdded(Cacheable <IUserMessage, ulong> message, ISocketMessageChannel channel, SocketReaction reaction) { if (channel == baseService.RoleChannel) { await messageService.CheckMessagesAsync(); var msg = await message.GetOrDownloadAsync(); var raid = new Raid(); foreach (var rctn in msg.Reactions) { foreach (var user in await msg.GetReactionUsersAsync(rctn.Key, 1000).FirstOrDefault()) { if (user.Id != client.CurrentUser.Id) { if (!Strings.Reactions.Contains(rctn.Key.Name.ToLower())) { await msg.RemoveReactionAsync(rctn.Key, user); continue; } var role = baseService.ParseRole(rctn.Key.Name); if (Strings.Roles.Contains(role)) { var tmp = baseService.Guild.Users.FirstOrDefault(x => x.Id == user.Id); var raider = new Raider { User = user, Name = tmp.Nickname ?? tmp.Username, Role = rctn.Key }; var existing = raid.Raiders.Any(x => x.Name == raider.Name); raid.Raiders.Add(raider); if (existing) { var emotes = new List <IEmote>(); foreach (var rdr in raid.Raiders.Where(x => x.Name == raider.Name).ToList()) { raid.Raiders.Remove(rdr); emotes.Add(rdr.Role); } await msg.RemoveReactionsAsync(user, emotes.ToArray()); } if (tmp != null) { if (!tmp.Roles.Contains(baseService.GetGuildRole(baseService.Guild, role))) { await baseService.ModifyRole(baseService.Guild, tmp, role); } } } } } } } }
private void RaiderToolStripMenuItem_Click(object sender, EventArgs e) { var raider = new Raider() { StartPosition = FormStartPosition.CenterScreen }; this._openforms.Add(raider); raider.Show(); }
public async Task <bool> DeleteRaiderAsync(Raider raider) { if (raider is null) { return(false); } _context.RaidersDto.Remove(_mapper.Map <RaiderDto>(raider)); return(await _context.SaveChangesAsync() > 0); }
public async Task <bool> UpdateRaiderAsync(Raider raiderToUpdate) { if (raiderToUpdate is null) { return(false); } _context.RaidersDto.Update(_mapper.Map <RaiderDto>(raiderToUpdate)); return(await _context.SaveChangesAsync() > 0); }
void Start() { image = Resources.Load("Feuer_Debuff", typeof(Material)) as Material; if (GameControl.control.difficulty == 0) { damagePerTick *= GameControl.control.easyMultiplier; damageIncrease *= GameControl.control.easyMultiplier; } raider = GetComponent <Raider>(); StartCoroutine(ApplyDamage()); }
private void GenerateBuff(Raider raider) { if (!raider.GetGameObject().GetComponent <FlammeBuff>()) { FlammeBuff buff = raider.GetGameObject().AddComponent <FlammeBuff>(); raider.GetGameObject().GetComponent <BuffManager>().RegisterBuff(buff); } else { raider.GetGameObject().GetComponent <FlammeBuff>().Reset(); } }
/// <summary> /// Deregisters a dd. /// </summary> /// <param name="dd">The dd.</param> public void DeRegisterDD(Raider dd) { if (raiderDict.Contains(dd)) { raiderDict.Remove(dd); } if (ddDict.Contains(dd)) { ddDict.Remove(dd); } }
/// <summary> /// Deregisters a tank. /// </summary> /// <param name="tank">The tank.</param> public void DeRegisterTank(Raider tank) { if (raiderDict.Contains(tank)) { raiderDict.Remove(tank); } if (tankDict.Contains(tank)) { tankDict.Remove(tank); } }
public void OnConfirmRegisterButtonClick(Raider raider) { MainController.s_Instance.dbController.PostNewRaider((result) => { if (VerifyRegister(result)) { CloseRegister(); MainController.s_Instance.rosterController.OnPostNewRaider(); OpenLogin(); } }, raider); }
private void OnRaidBanCommand(BotShell bot, CommandArgs e) { int duration = 0; try { if (e.Args.Length < 2) { throw new Exception(); } duration = Convert.ToInt32(e.Args[1]); if (duration < 1) { throw new Exception(); } } catch { bot.SendReply(e, "Correct Usage: raid ban [username] [minutes]"); return; } string character = Format.UppercaseFirst(e.Args[0]); if (bot.GetUserID(character) < 100) { bot.SendReply(e, "No such user: "******"The duration of your suspension has been set to " + HTML.CreateColorString(bot.ColorHeaderHex, banned.Duration.ToString()) + " minutes by " + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender)); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, character + "'s") + " raid ban duration has been updated to " + HTML.CreateColorString(bot.ColorHeaderHex, banned.Duration.ToString()) + " minutes"); this._core.Log(character, e.Sender, this.InternalName, "bans", string.Format("{0}'s raid ban duration has been updated to {1} minutes", character, banned.Duration)); } else { bot.SendPrivateMessage(character, bot.ColorHighlight + "Your access to the raid has been suspended for " + HTML.CreateColorString(bot.ColorHeaderHex, banned.Duration.ToString()) + " minutes by " + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender)); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, character) + " has been banned from the raid for " + HTML.CreateColorString(bot.ColorHeaderHex, banned.Duration.ToString()) + " minutes"); this._core.Log(character, e.Sender, this.InternalName, "bans", string.Format("{0} has banned from the raid for {1} minutes", character, banned.Duration)); } this._bans.Add(main, banned); } }
/// <summary> /// Called when a cast is sucesfully finished. Applies the PrayerBuff to the target. /// </summary> public override void OnCastSucess() { Raider target = GetTarget(); if (!target.GetGameObject().GetComponent <PrayerBuff>()) { target.GetGameObject().AddComponent <PrayerBuff>(); } else { target.GetGameObject().GetComponent <PrayerBuff>().Reset(); } }
public override float ComputeRating() { var self = Raider.Self; float distanceToNext = Raider.DistanceToNextMine(); float hpAtNextMine = self.Life - distanceToNext; float threat = Raider.GetThreat(5); float needMines = 1.0f - 0.5f * self.MineRatio; //Range 0..1 float mineValue = needMines * (1 - threat) * Step(MINING_MIN_HP, hpAtNextMine); return(base.ComputeRating() * mineValue); }