public static void Add(dbDataContext db, string unitName) { unit newUnit = new unit(); newUnit.unit_name = unitName; db.units.InsertOnSubmit(newUnit); db.SubmitChanges(); }
/// <summary> /// converts from string type to unit type /// </summary> /// <param name="input"> /// string input to be converted /// </param> /// <param name="output"> /// Unit output /// </param> /// <returns> /// Returns true if convert was successful, false otherwise /// </returns> static bool stringToUnit(string input, ref unit output) { // temporary string not to change the value of input string temp = input; // return value bool rv = true; // convert to lower case to ignore case temp = temp.ToLower(); // if statement going through each possible case if (temp == "feet" || temp == "foot") { output = unit.FEET; } else if (temp == "meter" || temp == "meters") { output = unit.METER; } else if (temp == "miles" || temp == "mile") { output = unit.MILES; } else if (temp == "ounce" || temp == "ounces") { output = unit.OUNCES; } else if (temp == "quart" || temp == "quarts") { output = unit.QUARTS; } else if (temp == "liters" || temp == "liter") { output = unit.LITERS; } else if (temp == "square feet" || temp == "square foot") { output = unit.SQFEET; } else if (temp == "square miles" || temp == "square mile") { output = unit.SQMILES; } else if (temp == "acre" || temp == "acres") { output = unit.ACRES; } else { rv = false; } return(rv); }
/// <summary> /// <para>Determines whether the attacker is in front of the attacked with the given tolerance in degrees.</para> /// <para>A tolernace of 360 means the target can be attacked from anywhere while being considered "infront".</para> /// </summary> /// <param name="attacker">The unit performing the attack.</param> /// <param name="attacked">The unit being attacked.</param> /// <param name="tolerance">In degrees.</param> public static bool IsAttackerInfrontUnit(unit attacker, unit attacked, float tolerance) { var attackerAngle = AngleBetweenPoints(GetUnitX(attacked), GetUnitY(attacked), GetUnitX(attacker), GetUnitY(attacker)); var attackedAngle = GetUnitFacing(attacked); var maxAllowedAngle = 360 - (0.5f * tolerance); var minAllowedAngle = 0.5f * tolerance; var difference = Math.Abs(attackerAngle - attackedAngle); return(difference < minAllowedAngle || difference > maxAllowedAngle); }
public ActionResult Create([Bind(Include = "id_unit,unitname,adress")] unit unit) { if (ModelState.IsValid) { db.unit.Add(unit); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(unit)); }
/// <summary> /// Calculates the distance from <paramref name="source"/> unit to <paramref name="target"/> unit. /// </summary> public static float DistanceBetweenPoints(unit source, unit target) { var x1 = GetUnitX(source); var y1 = GetUnitY(source); var x2 = GetUnitX(target); var y2 = GetUnitY(target); var diffx = x1 - x2; var diffy = y1 - y2; return(SquareRoot((diffx * diffx) + (diffy * diffy))); }
public override void Interact() { for (int i = 0; i < players.Count; i++) { Debug.Log("Deposit Wood"); unit u = players[i].GetComponent <unit>(); ResourceManager.Instance.DepositResource(u.unitStorage.GetResourceType(), u.unitStorage.DepositStorage(), u.playerTypes); u.ResumeLastTask(); } }
public void manual_summon(unit hero) { if (hero.IsDisposed) { return; } Current.unit = hero; Current.unit.Updated = true; Current.unit.playSound(UnitAckSounds.Ready); }
// Use this for initialization void Start() { Debug.Log("twoD is" + Qrole.transform.Find("twoD")); Debug.Log("unit is" + Qrole.transform.Find("twoD").GetComponent <unit>()); Qunit = Qrole.transform.Find("twoD").GetComponent <unit>(); Eunit = Erole.transform.Find("twoD").GetComponent <unit>(); Debug.Log("goto_AI is" + Qrole.transform.GetComponent <goTo_AI_player>()); Qrole.transform.GetComponent <goTo_AI_player>().Marker = 'Q'; Erole.transform.GetComponent <goTo_AI_player>().Marker = 'E'; Debug.Log("Erole is" + Erole.name); }
public ActionResult Create([Bind(Include = "Unit_no,Song,Genres,Language,Album")] unit unit) { if (ModelState.IsValid) { db.units.Add(unit); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(unit)); }
public ActionResult Create([Bind(Include = "ID,Name,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy")] unit unit) { if (ModelState.IsValid) { db.units.Add(unit); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(unit)); }
static bool filterCondition() { // The unit being potentially filtered out of the group unit checkedUnit = GetFilterUnit(); // The unit that activated the trigger, in this case the caster unit caster = GetTriggerUnit(); // Include unit in the group if its an enemy and selectable (not dead or dying) return(IsUnitEnemy(checkedUnit, GetOwningPlayer(caster)) && BlzIsUnitSelectable(checkedUnit)); }
public Homing(unit caster, unit target) : base(caster, target) { CasterZ = 50; TargetImpactZ = 50; Speed = 800; TurnRate = 90; Roll = 90; EffectScale = 1.0f; EffectString = @"Abilities\Weapons\GlaiveMissile\GlaiveMissile.mdl"; CollisionRadius = 300; }
void player_unit_summon(object sender, DotaHIT.Jass.Native.Events.DHJassEventArgs e) { unit u = e.args["unit"] as unit; // if it's a hero if (u.primary != PrimAttrType.None) { Current.unit = u; Current.unit.playSound(UnitAckSounds.Ready); } }
/// <summary> /// Returns item's current slot in u's inventory, otherwise -1. /// </summary> /// <param name="u"></param> /// <param name="it"></param> /// <returns></returns> public static int GetItemSlot(unit u, item it) { for (int i = 0; i < UnitInventorySize(u); i++) { if (UnitItemInSlot(u, i) == it) { return(i); } } return(-1); }
void MouseOver_Unit(GameObject ourHitObject) { GameObject gameO = GameObject.Find("game"); string whosTurn = gameO.GetComponent <gameController>().turn; if (Input.GetMouseButtonDown(0)) { selectedUnitTwo = ourHitObject.GetComponent <unit>(); try { if (selectedUnitTwo.permission != whosTurn) { GameObject unitTile = GameObject.Find("hexTile_" + selectedUnit.x + "_" + selectedUnit.y); GameObject attackTile = GameObject.Find("hexTile_" + selectedUnitTwo.x + "_" + selectedUnitTwo.y); attackUnit(unitTile, attackTile); //selectedUnitTwo = null; return; //attack unit } } catch { Debug.Log("Something went wrong"); } selectedUnit = ourHitObject.GetComponent <unit>(); if (selectedUnit.permission == whosTurn) { turnOffEnergy(); //finds energy canvas -Pedro GameObject canvasObject = GameObject.FindGameObjectWithTag("energy"); Transform textTr = canvasObject.transform.Find("energyPanel/energyLabel"); Transform textPanel = canvasObject.transform.Find("energyPanel"); Text energyText = textTr.GetComponent <Text>(); textPanel.gameObject.SetActive(true); //TURN OFF ALL LIGHTS HERE GameObject.Find("hexTile_0_0").GetComponent <Hex>().turnOffAllLights(); //change energy label and position -Pedro energyText.text = "Energy : " + selectedUnit.energy.ToString(); if (selectedUnit.energy > 0) { GameObject onTile = GameObject.Find("hexTile_" + selectedUnit.x + "_" + selectedUnit.y); onTile.GetComponent <Hex>().showPath(onTile.GetComponent <Hex>().GetNeighbours()); } } } }
private void LateUpdate() { // Debug.Log("LATE PDATE: " + UnitsOnScreen.Count); if ((isDrag) && UnitsOnScreen.Count > 0) { clearSelection(); if (unitsInDrag != null) { cleardrag(); } for (int i = 0; i < UnitsOnScreen.Count; i++) { GameObject unitObj = UnitsOnScreen[i] as GameObject; if (unitObj != null) { unit UnitScript = unitObj.GetComponent <unit>(); GameObject selectedObj = unitObj.transform.Find("selected").gameObject; // Debug.Log(Client.getMyConId()); if (!UnitAlreadySelected(unitObj)) // && (myConId == Client.getMyConId()) { if (UnitsInDragBox(UnitScript.ScreenPos) && unitObj.gameObject.GetComponent <SoldierScript>().enabled == true) { selectedObj.active = true; unitsInDrag.Add(unitObj); selectedObjets.Add(unitObj); hideCanvases(); if (unitObj.name == "worker(Clone)") { buildCanvas.SetActive(true); } else { unitsControler.SetActive(true); } } else { if (UnitAlreadySelected(unitObj)) { if (!UnitsInDragBox(UnitScript.ScreenPos)) { selectedObject.active = false; } } } } } } } }
/// <summary> /// creates and extruder object when the portname is known I.E. COM1, COM2 /// </summary> /// <param name="portName">port to use for communication with the robot arm.</param> public extruder(string portName) { output = new Queue <string>(); units = unit.millimeters; coordinateMode = reference.incremental; configureExtruderPort(portName); currentExtrusion = 0; timer = new System.Windows.Forms.Timer(); timer.Interval = 1000; // Running every 1000 ms timer.Tick += Timer_Tick; timer.Enabled = true; }
public void DrawUnit(unit unit) { this.unit = unit; if (unit.parameters_vector2_int.ContainsKey("position")) { transform.position = new Vector3(unit.parameters_vector2_int["position"].x, 2, unit.parameters_vector2_int["position"].y); } else { transform.position = Vector3.up * 30; } }
public void makeEnemyUnit(int i) { GameObject gameO = GameObject.Find("game"); string whosTurn = gameO.GetComponent <gameController>().turn; if (whosTurn == "enemy") { //IF SPAWN TILE NOT TAKEN GameObject spawnTile = GameObject.Find("hexTile_" + ("14_") + ("7")); if (spawnTile.GetComponent <Hex>().status == "Free") //Make green unit { Vector3 spawnPos = spawnTile.transform.position; GameObject newUnit = (GameObject)Instantiate(pyramidPrefab, spawnPos, Quaternion.identity); MeshRenderer newUnitMesh = newUnit.GetComponentInChildren <MeshRenderer>(); enemy enemy = GameObject.Find("enemyPlayer").GetComponent <enemy>(); unit newUnitStats = newUnit.GetComponent <unit>(); newUnit.name = "enemyUnit_" + (enemy.unitAmount + 1); newUnitStats.x = 14; newUnitStats.y = 7; newUnitStats.permission = "enemy"; GameObject[] enemyUnits = enemy.enemyUnits; int unitAmount = enemy.unitAmount; enemyUnits[unitAmount] = newUnit; enemy.unitAmount = unitAmount + 1; if (i == 0) // Green Unit { newUnitStats.energy = 2; newUnitStats.defaultEnergy = 2; newUnitStats.timeToProduce = 1; newUnitMesh.material.color = new Color(172f / 255f, 215f / 255f, 0f / 255f); } else if (i == 1) // Orange Unit { newUnitStats.energy = 3; newUnitStats.defaultEnergy = 3; newUnitStats.timeToProduce = 2; newUnitMesh.material.color = new Color(255 / 255f, 11f / 255f, 0 / 255f); } else if (i == 2) // Blue Unit { newUnitStats.energy = 5; newUnitStats.defaultEnergy = 5; newUnitStats.timeToProduce = 5; newUnitMesh.material.color = new Color(36f / 255f, 101f / 255f, 237f / 255f); } enemyUnitsList.Add(newUnitStats); //GameObject.Find("MouseManager").GetComponent<mouseManager>().turnOffMenu(); } } }
//DEBUG STUFF BOARD public void printSingleBoard(int layerIn) { if (layerIn == 0) { int layer = 0 + layerIn; string printString = ""; string layerAdd = " "; string LA = "\n"; for (int i = 0; i < layer; i++) { LA += layerAdd; } layer += 1; printString += LA + sequence; printString += LA + layerAdd + "PSCORE: " + PScore; printString += LA + layerAdd + "ESCORE: " + EScore; printString += LA + layerAdd + "UNITS: "; foreach (string key in OS.Keys) { layer += 1; unit currentUnit = (unit)OS [key]; printString += LA + layerAdd + layerAdd + "UNIT AT: " + key; layer += 1; printString += LA + layerAdd + layerAdd + layerAdd + key; printString += LA + layerAdd + layerAdd + layerAdd + "PLAYER OWNED: " + currentUnit.playerOwned; printString += LA + layerAdd + layerAdd + layerAdd + "MOVES:"; foreach (string moveKey in currentUnit.moves.Keys) { layer += 1; printString += LA + layerAdd + layerAdd + layerAdd + layerAdd + moveKey; //printString += LA + layerAdd + layerAdd + layerAdd + layerAdd + layerAdd + "PSCORE: " + ((board) currentUnit.moves [moveKey]).PScore.ToString(); //printString += LA + layerAdd + layerAdd + layerAdd + layerAdd + layerAdd + "ESCORE: " + ((board)currentUnit.moves [moveKey]).EScore.ToString (); } } FileStream createFile = new FileStream("Logs/" + sequence + ".txt", FileMode.OpenOrCreate, FileAccess.Write); createFile.WriteByte(1); createFile.Close(); StreamReader reader = new StreamReader("Logs/" + sequence + ".txt"); string textSoFar = ""; textSoFar += reader.ToString(); reader.Close(); //string FileName = "Logs/" + sequence + ".txt"; // This contains the name of the file. Don't add the ".txt" // Assign in inspector //TextAsset asset; // Gets assigned through code. Reads the file. //StreamWriter writer; // This is the writer that writes to the file StreamWriter writer = new StreamWriter("Logs/" + sequence + ".txt"); // Does this work? writer.WriteLine(textSoFar + printString); writer.Flush(); writer.Close(); //Debug.Log (printString); //System.IO.File.WriteAllText("Logs/UnityLog.txt", printString); } }
// Use this for initialization void Start() { animator = gameObject.GetComponent <Animator>(); unit = (unit)gameObject.GetComponent("unit"); //屬性加成 damage += (int)(damage * 1.5f * (unit.skill / 100)); stiff += stiff * (unit.stiffable / 100); interval -= interval * (unit.attackSpeed / 100); // }
public void AddUnit(UnitDTO tempUnit) { using (var context = new MSSContext()) { unit newUnit = new unit(); newUnit.unitname = tempUnit.unitname; newUnit.caresiteid = tempUnit.caresiteid; newUnit.activeyn = true; context.units.Add(newUnit); context.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "unitid,unit_id,unit_description_english,unit_abreviation_english,unit_description_french,unit_abreviation_french,unit_status,unit_created_by,unit_created_datetime,unit_last_modified_by,unit_last_modified_datetime,unit_deleted_by,unit_deleted_datetime,unit_short_abreviation,office_id,HOU_ID")] unit unit) { if (ModelState.IsValid) { db.Entry(unit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.office_id = new SelectList(db.Country_office, "countryofficeid", "office_description_english", unit.office_id); ViewBag.HOU_ID = new SelectList(db.Country_office, "staffid", "staff_email", unit.HOU_ID); return(View(unit)); }
public static void SetMouseSpeed(unit speed) { for (int i = 0; i < args.Length; i++) { System.Console.WriteLine("Arg[{0}] = [{1}]", i, args[i]); } SystemParametersInfo( SPI_SETMOUSESPEED, 0, speed, 0); }
public Momentum(unit caster, unit target) : base(caster, target) { CasterZ = 50; TargetImpactZ = 50; Speed = 100; MaximumSpeed = 1000; Acceleration = 25; InitialAngle = GetRandomReal(0, 360); EffectScale = 1.0f; Roll = 90; EffectString = @"Abilities\Weapons\GlaiveMissile\GlaiveMissile.mdl"; Interval = 5.0f; }
public void setHUD(unit unit) { nameText.text = unit.UnitName; PhysicalitySlider.maxValue = unit.maxPysicality; PhysicalitySlider.value = unit.currentPysicality; JoySlider.maxValue = unit.maxJoy; JoySlider.value = unit.currentJoy; MeaningSlider.maxValue = unit.maxMeaning; MeaningSlider.value = unit.currentMeaning; }
public void setHUD(unit unit) { nameText.text = unit.UnitName; HPSlider.maxValue = unit.maxHP; HPSlider.value = unit.currentHP; AtkModSlider.maxValue = unit.maxAtkMod; AtkModSlider.value = unit.currentAtkMod; DefModSlider.maxValue = unit.maxDefMod; DefModSlider.value = unit.currentDefMod; }
private void bAddUnit_Click(object sender, RoutedEventArgs e) {//обработчик кнопки добавить Windows.unitWindow uw = new unitWindow(); uw.ShowDialog(); if (uw.DialogResult == true) //если пользователь ввел значение { //создаем объект, заполняем и добавляем в модель бд unit newUnit = new unit(); newUnit.name = uw.Name; core.serviceCenterDB.units.Add(newUnit); core.serviceCenterDB.SaveChanges(); updateCbUnits(); } }
public void showPrimAttrToolTip(unit hero) { UIRichTextEx.Default.ClearText(); if (hero == null) { return; } UIRichTextEx.Default.AddText("Hero Attributes:", UIFonts.boldArial8, Color.White); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Strength", Color.White); if (hero.primary == PrimAttrType.Str) { UIRichTextEx.Default.AddText("\n - Primary Attribute", Color.Yellow); UIRichTextEx.Default.AddText("\n-Each point increases damage by 1", Color.White); } UIRichTextEx.Default.AddText("\n-Each point increases hit points by 19", Color.White); UIRichTextEx.Default.AddText("\n-Each point increases hit point regen"); UIRichTextEx.Default.AddText("\nStrength per level: " + hero.strPerLvl, Color.Gray); UIRichTextEx.Default.AddText("\nHit point regen: " + hero.hpRegen); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Agility", Color.White); if (hero.primary == PrimAttrType.Agi) { UIRichTextEx.Default.AddText("\n - Primary Attribute", Color.Yellow); UIRichTextEx.Default.AddText("\n-Each point increases damage by 1", Color.White); } UIRichTextEx.Default.AddText("\n-Every 7 points increase armor by 1"); UIRichTextEx.Default.AddText("\n-Each point increases attack speed by 1%"); UIRichTextEx.Default.AddText("\nAgility per level: " + hero.agiPerLvl, Color.Gray); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Intelligence", Color.White); if (hero.primary == PrimAttrType.Int) { UIRichTextEx.Default.AddText("\n - Primary Attribute", Color.Yellow); UIRichTextEx.Default.AddText("\n-Each point increases damage by 1", Color.White); } UIRichTextEx.Default.AddText("\n-Each point increases mana by 13"); UIRichTextEx.Default.AddText("\n-Each point increases mana regen"); UIRichTextEx.Default.AddText("\nIntelligence per level: " + hero.intPerLvl, Color.Gray); UIRichTextEx.Default.AddText("\nMana regen: " + hero.manaRegen + " mana/sec"); contentRTB.Rtf = UIRichTextEx.Default.CloseRtf(); }
/// <summary> /// Uses a dictionary to quickly find all buffs attached to the given unit. /// </summary> public static IEnumerable <Buff> GetBuffsOnUnit(unit unit) { if (buffsByUnit.TryGetValue(unit, out var buffs)) { for (var i = 0; i < buffs.Count; i++) { var buff = buffs[i]; if (buff.Active) { yield return(buff); } } } }
/// <summary> /// Creates a new <see cref="Lightning"/> instance with the given parameters. /// <para>Will automatically set <see cref="CasterX"/>, <see cref="CasterY"/>, <see cref="TargetX"/> and <see cref="TargetY"/>.</para> /// </summary> /// <param name="name">The name of the lightning effect. See <see href="https://www.hiveworkshop.com/threads/beginners-guide-to-lightning-effects.220370/"/>.</param> /// <param name="caster">The source of the lightning. Will automatically update the position when <paramref name="caster"/> moves.</param> /// <param name="target">The target of the lightning. Will automatically update the position when <paramref name="target"/> moves.</param> public Lightning(string name, unit caster, unit target) { this.name = name; this.casterZ = BlzGetUnitZ(caster) + GetUnitFlyHeight(caster); this.targetZ = BlzGetUnitZ(target) + GetUnitFlyHeight(target); Caster = caster; CasterX = GetUnitX(caster); CasterY = GetUnitY(caster); Target = target; TargetX = GetUnitX(target); TargetY = GetUnitY(target); }
public void showArmorToolTip(unit hero) { UIRichTextEx.Default.ClearText(); if (hero == null) return; UIRichTextEx.Default.AddText("Armor: " + hero.armor, UIFonts.boldArial8, Color.White); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Type: ", Color.Gray); UIRichTextEx.Default.AddText("Hero", Color.Yellow); UIRichTextEx.Default.AddText("\nDamage reduction: " + hero.get_damage_reduction() + "%", Color.Gray); UIRichTextEx.Default.AddText("\nMove speed: " + hero.moveSpeed); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Heroes take reduced damage from Piercing, Magic,\nSiege attacks, and Spells", Color.White); contentRTB.Rtf = UIRichTextEx.Default.CloseRtf(); }
private void dieB_Click(object sender, EventArgs e) { if (suicideRB.Checked) { Current.unit.OnDeath(Current.unit); Current.unit.playSound(AnimSounds.Death); } else switch (deathsCmbB.SelectedIndex) { case 0: // enemy hero int streak = streakCmbB.SelectedIndex; if (streak > 0) streak += 2; player enemyPlayer = player.players[7]; player alliedPlayer = player.players[2]; unit enemyHero = new unit(); enemyHero.codeID = "Hero"; // so triggers could work with id enemyHero.ID.Value = "[Enemy Hero that will kill you]"; enemyHero.primary = PrimAttrType.Str; // only heroes have primary attributes enemyHero.Level = (int)heroLevelNumUD.Value; enemyHero.set_owningPlayer(enemyPlayer); // generate killing streak for enemy hero // by killing allied heroes for (int j = 0; j < streak; j++) { unit victim = new unit(); victim.codeID = "Prey"; victim.ID.Value = "[Allied Victim]"; victim.primary = PrimAttrType.Str; victim.set_owningPlayer(alliedPlayer); victim.OnDeath(enemyHero); victim.destroy(); } // enemy hero kills our hero Current.unit.OnDeath(enemyHero); enemyHero.destroy(); break; case 1: // allied hero alliedPlayer = player.players[2]; unit ally = new unit(); ally.codeID = "Ally"; ally.ID.Value = "[Allied Killer]"; ally.primary = PrimAttrType.Str; ally.set_owningPlayer(alliedPlayer); // allied hero kills our hero Current.unit.OnDeath(ally); ally.destroy(); break; case 2: // enemy creep HabProperties hpsProfile = creepsCmbB.SelectedItem as HabProperties; player enemyCreepPlayer = player.players[6]; unit creep = enemyCreepPlayer.add_unit(hpsProfile.name); // creep kills our hero Current.unit.OnDeath(creep); creep.destroy(); break; case 3: // neutral creep hpsProfile = creepsCmbB.SelectedItem as HabProperties; player neutralPlayer = player.players[12]; creep = neutralPlayer.add_unit(hpsProfile.name); // creep kills our hero Current.unit.OnDeath(creep); creep.destroy(); break; case 4: // unknown source Current.unit.OnDeath(null); break; } }
public void showHeroToolTip(unit hero) { this.Visible = false; UIRichTextEx.Default.ClearText(); if (hero == null) return; UIRichTextEx.Default.AddTaggedText(hero.tip + "", UIFonts.boldArial8, Color.White); tipRTB.Rtf = UIRichTextEx.Default.CloseRtf(); ShowPrices(hero.goldCost, null); UIRichTextEx.Default.ClearText(); UIRichTextEx.Default.AddTaggedText(hero.description + "", UIFonts.boldArial8, Color.White); ubertipRTB.Rtf = UIRichTextEx.Default.CloseRtf(); }
public void manual_summon(unit hero) { if (hero.IsDisposed) return; Current.unit = hero; Current.unit.Updated = true; Current.unit.playSound(UnitAckSounds.Ready); }
partial void Updateunit(unit instance);
public UnitStatsCalculator(unit unit, int armorDamage) { this.unit = unit; this.armorDamage = armorDamage; }
public void showPrimAttrToolTip(unit hero) { UIRichTextEx.Default.ClearText(); if (hero == null) return; UIRichTextEx.Default.AddText("Hero Attributes:", UIFonts.boldArial8, Color.White); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Strength", Color.White); if (hero.primary == PrimAttrType.Str) { UIRichTextEx.Default.AddText("\n - Primary Attribute", Color.Yellow); UIRichTextEx.Default.AddText("\n-Each point increases damage by 1", Color.White); } UIRichTextEx.Default.AddText("\n-Each point increases hit points by 19",Color.White); UIRichTextEx.Default.AddText("\n-Each point increases hit point regen"); UIRichTextEx.Default.AddText("\nStrength per level: "+hero.strPerLvl, Color.Gray); UIRichTextEx.Default.AddText("\nHit point regen: "+hero.hpRegen); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Agility", Color.White); if (hero.primary == PrimAttrType.Agi) { UIRichTextEx.Default.AddText("\n - Primary Attribute", Color.Yellow); UIRichTextEx.Default.AddText("\n-Each point increases damage by 1", Color.White); } UIRichTextEx.Default.AddText("\n-Every 7 points increase armor by 1"); UIRichTextEx.Default.AddText("\n-Each point increases attack speed by 1%"); UIRichTextEx.Default.AddText("\nAgility per level: " + hero.agiPerLvl, Color.Gray); UIRichTextEx.Default.AddLineInterval(); UIRichTextEx.Default.AddText("Intelligence", Color.White); if (hero.primary == PrimAttrType.Int) { UIRichTextEx.Default.AddText("\n - Primary Attribute", Color.Yellow); UIRichTextEx.Default.AddText("\n-Each point increases damage by 1", Color.White); } UIRichTextEx.Default.AddText("\n-Each point increases mana by 13"); UIRichTextEx.Default.AddText("\n-Each point increases mana regen"); UIRichTextEx.Default.AddText("\nIntelligence per level: " + hero.intPerLvl, Color.Gray); UIRichTextEx.Default.AddText("\nMana regen: " + hero.manaRegen + " mana/sec"); contentRTB.Rtf = UIRichTextEx.Default.CloseRtf(); }
/// <summary> /// converts from string type to unit type /// </summary> /// <param name="input"> /// string input to be converted /// </param> /// <param name="output"> /// Unit output /// </param> /// <returns> /// Returns true if convert was successful, false otherwise /// </returns> static bool stringToUnit(string input, ref unit output) { // temporary string not to change the value of input string temp = input; // return value bool rv = true; // convert to lower case to ignore case temp = temp.ToLower(); // if statement going through each possible case if (temp == "feet" || temp == "foot") output = unit.FEET; else if (temp == "meter" || temp == "meters") output = unit.METER; else if (temp == "miles" || temp == "mile") output = unit.MILES; else if (temp == "ounce" || temp == "ounces") output = unit.OUNCES; else if (temp == "quart" || temp == "quarts") output = unit.QUARTS; else if (temp == "liters" || temp == "liter") output = unit.LITERS; else if (temp == "square feet" || temp == "square foot") output = unit.SQFEET; else if (temp == "square miles" || temp == "square mile") output = unit.SQMILES; else if (temp == "acre" || temp == "acres") output = unit.ACRES; else rv = false; return rv; }
private void killHeroB_Click(object sender, EventArgs e) { int streak = streakCmbB.SelectedIndex; if (streak > 0) streak += 2; player enemyPlayer = player.players[7]; player alliedPlayer = player.players[2]; for (int i = 0; i < (int)heroesNumUD.Value; i++) { unit enemyHero = new unit(); enemyHero.codeID = "Hero"; // so triggers could work with id enemyHero.ID.Value = "[Enemy Hero to be killed]"; enemyHero.primary = PrimAttrType.Str; // only heroes have primary attributes enemyHero.Level = (int)heroLevelNumUD.Value; enemyHero.set_owningPlayer(enemyPlayer); // generate killing streak for enemy hero // by killing allied heroes for (int j = 0; j < streak; j++) { unit victim = new unit(); victim.codeID = "Prey"; victim.ID.Value = "[Allied Victim]"; victim.primary = PrimAttrType.Str; victim.set_owningPlayer(alliedPlayer); victim.OnDeath(enemyHero); victim.destroy(); } // now our hero kills this enemy hero enemyHero.OnDeath(Current.unit); enemyHero.destroy(); } }
partial void Insertunit(unit instance);
int compareUnits(unit x, unit y) { return Comparer<int>.Default.Compare(x.handle, y.handle); }
partial void Deleteunit(unit instance);
/// <summary> /// converts value given from unit from to unit to. /// </summary> /// <param name="value"></param> /// the value to be converted /// <param name="from"></param> /// the unit of the value provided the param value /// <param name="to"></param> /// the unit of the return value /// <returns> /// returns the converted value /// </returns> static bool convert(unit from, double input, unit to, ref double output) { // return value bool rv = true; // switch through all conversions switch (from) { case unit.FEET: switch (to) { case unit.FEET: output = input; break; case unit.METER: output = input * 0.3048; break; case unit.MILES: output = input / 5280; break; default: rv = false; break; } break; case unit.METER: switch (to) { case unit.FEET: output = input * 3.28084; break; case unit.METER: output = input; break; case unit.MILES: output = input / 1609.34; break; default: rv = false; break; } break; case unit.MILES: switch (to) { case unit.FEET: output = input * 5280; break; case unit.METER: output = input * 1609.34; break; case unit.MILES: output = input; break; default: rv = false; break; } break; case unit.OUNCES: switch (to) { case unit.OUNCES: output = input; break; case unit.QUARTS: output = input * 0.03125; break; case unit.LITERS: output = input * 0.0295735; break; default: rv = false; break; } break; case unit.QUARTS: switch (to) { case unit.OUNCES: output = input * 32; break; case unit.QUARTS: output = input; break; case unit.LITERS: output = input * 0.946353; break; default: rv = false; break; } break; case unit.LITERS: switch (to) { case unit.OUNCES: output = input * 33.814; break; case unit.QUARTS: output = input * 1.05669; break; case unit.LITERS: output = input; break; default: rv = false; break; } break; case unit.SQFEET: switch (to) { case unit.SQFEET: output = input; break; case unit.SQMILES: output = input / 27878400; break; case unit.ACRES: output = input / 43560; break; default: rv = false; break; } break; case unit.SQMILES: switch (to) { case unit.SQFEET: output = input * 27878400; break; case unit.SQMILES: output = input; break; case unit.ACRES: output = input * 43560; break; default: rv = false; break; } break; case unit.ACRES: switch (to) { case unit.SQFEET: output = input * 43560; break; case unit.SQMILES: output = input / 640; break; case unit.ACRES: output = input; break; default: rv = false; break; } break; } return rv; }