private void Init() { ddlTempType.Properties.Items.Clear(); ddlTempType.Properties.Items.AddRange(Enum.GetValues(typeof(TempSetType))); ddlTempType.SelectedIndex = 0; sign = ControlService.SignCombo.Current; TempSet tempSet = new TempSet(); tempSet.Type = -1; tempSet.Value = ""; tempSet.Mode = 1; sign.Controller.SendAsync( Commands.TempOffset, p => { Cursor = Cursors.Default; if (p.IsSuccessed) { int type = p.Packet.Content.GetProperty <int>("Type"); string value = p.Packet.Content.GetProperty <string>("Value"); ddlTempType.SelectedIndex = type; txtTemp.Text = value; } }, tempSet); }
public override void InitBeing() { StatSet stats = (being as IStatBeing).Stats; stats["In"].Value = Rng.Random.Next(2) + 5; stats["Dx"].Value = Rng.Random.Next(2) + 7; stats["St"].Value = Rng.Random.Next(2) + 5; stats["To"].Value = Rng.Random.Next(2) + 4; stats["Pe"].Value = Rng.Random.Next(2) + 5; TempSet temps = (being as ITempsBeing).Temps; temps["potion-identification"] = true; if (Rng.Random.NextFloat() > 0.5f) { temps["illness-resistance"] = true; } else { temps["illness-resistance"] = true; } Equipment equipment = ((IEquipmentBeing)being).Equipment; ItemFacade facade = new ItemFacade(); equipment.Slots[0].Item = facade.CreateItemById("hat"); equipment.Slots[2].Item = facade.CreateItemById("knife"); equipment.Slots[3].Item = facade.CreateItemById("clothes"); being.Color = equipment.Slots[3].Item.Color; }
public override void InitBeing() { StatSet stats = (being as IStatBeing).Stats; stats["In"].Value = Rng.Random.Next(2) + 9; stats["Dx"].Value = Rng.Random.Next(2) + 4; stats["St"].Value = Rng.Random.Next(2) + 2; stats["To"].Value = Rng.Random.Next(2) + 3; stats["Pe"].Value = Rng.Random.Next(2) + 8; TempSet temps = (being as ITempsBeing).Temps; temps["ring-identification"] = true; temps["neckwear-identification"] = true; temps["scroll-identification"] = true; Equipment equipment = ((IEquipmentBeing)being).Equipment; ItemFacade facade = new ItemFacade(); equipment.Slots[0].Item = facade.CreateItemById("hat"); equipment.Slots[2].Item = facade.CreateItemById("kluka"); equipment.Slots[3].Item = facade.CreateItemById("clothes"); being.Color = equipment.Slots[3].Item.Color; }
private void showStatus() { console.Clear(55, 49, 21, 1); console.GoTo(55, 49); TempSet temps = (Pc as ITempsBeing).Temps; showStatusPart(temps["confused"], "Os "); showStatusPart(temps["ill"], "Ch "); showStatusPart(temps["poisoned"], "Za "); showStatusPart(temps["blind"], "Śl "); showStatusPart(pc.Health <= 3, "" + pc.Health + "/" + ((VhPc)pc).MaxHealth); }
public override bool Perform() { TempSet temps = (Performer as ITempsBeing).Temps; if (temps["poisoned"]) { temps["poisoned"] = false; notify("cure"); } return(true); }
public override bool Perform() { if (Performer is ISkillsBeing && Item is MagicalItem) { if ((Performer as ITempsBeing).Temps["blind"]) { notify("cant-examine"); return(false); } Skill identification = (Performer as ISkillsBeing).Skills["identification"]; bool unidentified = (Item as MagicalItem).HiddenName != item.Name; // automatic, class-dependant indentification if (unidentified) { TempSet temps = (Performer as ITempsBeing).Temps; if (Item is Potion && temps["potion-identification"] || Item is Scroll && temps["scroll-identification"] || Item.Id == "booze" && temps["booze-identification"] ) { (Item as MagicalItem).Identify(); notify("instant-recognition", item); return(true); } } // TODO: store separate identify value for each being. // not relevant yet, as beings other than the PC are not able to use identification, but bogus anyway. if (unidentified) { if (identification.Value > (Item as MagicalItem).IdentifyValue) { if (identification.Roll(Item.Danger)) { (Item as MagicalItem).Identify(); notify("identify", item); } else { notify("no-identify"); } (Item as MagicalItem).IdentifyValue = identification.Value; } else { notify("next-no-identify", item); } } } return(true); }
public override bool Perform() { TempSet temps = (Performer as ITempsBeing).Temps; if (!temps["blind"] && (!temps["blindness-resistance"] || Rng.Random.NextFloat() > RESISTANCE)) { temps["blind"] = true; notify("blinded"); } else { notify("not-blinded"); } return(true); }
public override bool Perform() { notify("bitter"); notify("warmth"); TempSet temps = (Performer as ITempsBeing).Temps; if (temps["ill"]) { temps["ill"] = false; notify("cure"); } // new CauseConfusionAction(Performer).Perform(); return(true); }
public override bool Perform() { TempSet temps = (Performer as ITempsBeing).Temps; if (temps["ill"]) { temps["ill"] = false; notify("cure"); } else { notify("refreshing"); } return(true); }
public override bool Perform() { TempSet temps = (Performer as ITempsBeing).Temps; if (!temps["confusion-resistance"] || Rng.Random.NextFloat() > RESISTANCE) { temps["confused"] = true; notify("confused"); } else { notify("not-confused"); } return(true); }
public override bool Perform() { TempSet temps = (Performer as ITempsBeing).Temps; if (temps["poison resistant"]) { notify("bitter"); } else { temps["poison resistant"] = true; temps["poisoned"] = true; notify("poisoned"); } return(true); }
public override bool Perform() { TempSet temps = (Performer as ITempsBeing).Temps; notify("bitter"); if (Rng.Random.NextFloat() < PETRIFICATION_RESISTANCE_RATE) { temps["petrification-resistance"] = true; if (Performer is IStatBeing) { StatSet stats = (Performer as IStatBeing).Stats; stats["St"].Value -= 1; } notify("petrification-resistance"); } return(true); }
private T CreateProduct <T>(IElement td, string restaurantId) where T : Product { IElement imgElement = td.QuerySelector("a.product-img"); IElement nameElemnt = td.QuerySelector("div.product-title"); string desc = GetData(td, "div.product-description"); string priceStr = GetData(td, "div.price"); string img = imgElement.Children.First().GetAttribute("src"); string fullImg = $"https://mafia.ua{img}"; string name = nameElemnt.Children.First().Text().Replace("\n", " ").Trim(); string test = GetData(td, "div.product-weight"); TempSet set = CreateTempSet(test); int? price = StringToInt(priceStr); string logo = GetLogoPath(RestaurantType.Mafia.ToString()); T product = CreatProduct <T>(name, desc, set.Weight, set.Count, price, fullImg, restaurantId, logo); return(product); }
public override void InitBeing() { StatSet stats = (being as IStatBeing).Stats; stats["In"].Value = Rng.Random.Next(2) + 2; stats["Dx"].Value = Rng.Random.Next(2) + 2; stats["St"].Value = Rng.Random.Next(2) + 7; stats["To"].Value = Rng.Random.Next(2) + 7; stats["Pe"].Value = Rng.Random.Next(2) + 4; TempSet temps = (being as ITempsBeing).Temps; //temps["blindness-resistance"] = true; temps["confusion-resistance"] = true; temps["booze-identification"] = true; Equipment equipment = (being as IEquipmentBeing).Equipment; ItemFacade facade = new ItemFacade(); equipment.Slots[0].Item = facade.CreateItemById("felt-beret"); equipment.Slots[2].Item = facade.CreateItemById("spade"); equipment.Slots[3].Item = facade.CreateItemById("felt-jacket"); StackingBackPack backpack = (being as IBackPackBeing).BackPack; backpack.Add(facade.CreateItemById("booze")); backpack.Add(facade.CreateItemById("booze")); backpack.Add(facade.CreateItemById("potion-of-amnesia")); foreach (Item item in backpack.Items) { if (item is MagicalItem) { (item as MagicalItem).Identify(); } } being.Color = equipment.Slots[3].Item.Color; }
public override bool Perform() { // if (Performer.Health <= Performer.MaxHealth - 2) { Performer.Health += Rng.Random.Next(2) + 1; notify("warmth"); } // TempSet temps = (Performer as ITempsBeing).Temps; if (temps["ill"] && Rng.Random.NextFloat() < CURE_RATE) { temps["ill"] = false; notify("cure"); } // if (Rng.Random.NextFloat() < DRUNK_RATE) { new CauseConfusionAction(Performer).Perform(); } return(true); }
public TempSet CreateTempSet(string str) { int[] setData = StringToIntArray(str); var set = new TempSet(); if (setData.Length < 2) { set.Weight = setData[0]; } if (setData.Length > 1) { if (setData[0] > setData[1]) { set.Count = setData[1]; set.Weight = setData[0]; return(set); } set.Count = setData[0]; set.Weight = setData[1]; } return(set); }
public override bool Perform() { if (performer.MaxHealth < performer.Health) { performer.Health = performer.MaxHealth; } // check for water if (performer is ISkillsBeing && GameController.Instance.Map[performer.Position] == Terrain.Get("water").Character) { if (((ISkillsBeing)performer).Skills["swimming"].Roll()) { notify("swim"); } else { notify("drown"); performer.DecreaseHealth(Rng.Random.Next(3), Translator.Instance["drowning"]); if (performer.Health <= 0) { notify("killed"); performer.Kill(); } } } // check for hidden stuff if (performer is ISkillsBeing) { for (int x = -1; x <= 1; ++x) { for (int y = -1; y <= 1; ++y) { Step step = new Step(x, y); Position position = performer.Position.AddStep(step); if (GameController.Instance.Map[position] == Terrain.Get("hidden-door").Character) { if (((ISkillsBeing)performer).Skills["searching"].Roll()) { GameController.Instance.Map[position] = Terrain.Get("closed-door").Character; notify("spot"); } } } } } // check for temps TempSet temps = (performer as ITempsBeing).Temps; if (temps["blind"] && Rng.Random.NextFloat() < BLINDNESS_RECOVERY_RATE) { temps["blind"] = false; notify("unblinded", true); } if (temps["confused"] && Rng.Random.NextFloat() < CONFUSION_RECOVERY_RATE) { temps["confused"] = false; notify("unconfused"); } float illnessRecoveryRate = ILLNESS_RECOVERY_RATE; if (temps["illness-resistance"]) { illnessRecoveryRate *= 2; } if (temps["ill"] && Rng.Random.NextFloat() < illnessRecoveryRate) { temps["ill"] = false; notify("cured"); } float poisoningRecoveryRate = POISONING_RECOVERY_RATE; if (temps["poison-resistance"]) { poisoningRecoveryRate *= 2; } if (temps["poisoned"] && Rng.Random.NextFloat() < poisoningRecoveryRate) { temps["poisoned"] = false; notify("cured"); } // return(true); }
public override bool Perform() { TempSet temps = (Performer as ITempsBeing).Temps; if (temps["confused"]) { // TODO confusion resistance may also be aquired through items if (!temps["confusion-resistance"] || Rng.Random.NextFloat() > CONFUSION_RATE) { step = Step.CreateRandomStep(); notify("stagger"); } else { notify("no-stagger"); } } Position newPosition = performer.Position.AddStep(step); // check if new position is within level limits if (newPosition.X < 0 || newPosition.Y < 0 || newPosition.X >= controller.Map.Width || newPosition.Y >= controller.Map.Height) { return(false); } // moving into a closed door results in an attempt to open them if (performer.CanWalkOn(Terrain.Get("open-door").Character) && controller.Map[newPosition] == Terrain.Get("closed-door").Character) { return(new OpenDoorAction(performer, step).Perform()); } // moving onto a wall results in an attept to dig through it // moving into a Being results in attacking it Being being = controller.GetBeingAt(newPosition); if (being != null && being != performer) { return(new AttackAction(performer, being).Perform()); } // check if performer is able to walk through whatever is at the level at new position, otherwise // interact with the terrain at the new position // for example:moving onto a wall results in an attept to dig through it char feature = controller.ViewPort.GetDisplayCharacter(controller.Map[newPosition]); if (!performer.CanWalkOn(feature)) { if (Performer.Ai.InteractWithEnvironment(newPosition)) { return(true); } } if (!performer.CanWalkOn(feature) || (being != null && being != performer)) { if ((Performer as ITempsBeing).Temps["blind"]) { notify("boom"); } return(false); } // perform move performer.Position = performer.Position.AddStep(step); showItemNames(); return(true); }
public override void FromXml(XmlElement element) { base.FromXml(element); temps = GetElement(TEMPS) as TempSet; }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtTemp.Text)) { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.TempoffsetNotEmpty));//"Sorry,the temperature value can't be empty."); return; } Cursor = Cursors.WaitCursor; sign = ControlService.SignCombo.Current; TempSet tempSet = new TempSet(); if (ddlTempType.Text == TempSetType.Celsius.ToString()) { tempSet.Type = Convert.ToInt32(TempSetType.Celsius); } else if (ddlTempType.Text == TempSetType.Fahrenheit.ToString()) { tempSet.Type = Convert.ToInt32(TempSetType.Fahrenheit); } else if (ddlTempType.Text == TempSetType.Kelvin.ToString()) { tempSet.Type = Convert.ToInt32(TempSetType.Kelvin); } //else if (ddlTempType.Text == TempSetType.NullTempType.ToString()) // tempSet.Type = Convert.ToInt32(TempSetType.NullTempType); else if (ddlTempType.Text == TempSetType.Rankine.ToString()) { tempSet.Type = Convert.ToInt32(TempSetType.Rankine); } tempSet.Value = txtTemp.Text; tempSet.Mode = 0; sign.Controller.SendAsync( Commands.TempOffset, p => { Cursor = Cursors.Default; if (p.IsSuccessed) { MsgBox.Information(Resources.Resource.GetString(Resources.Resource.Strings.SetTempoffsetSuccessed)); //"Temp offset Successfully Changed."); Close(); } else { MsgBox.Error(Resources.Resource.GetString(Resources.Resource.Strings.SetTempoffsetFailed)); //"Temp offset was not changed.Please try again."); } }, tempSet); //var task = sign.Controller.MAManager.SetTempOffset(txtTemp.Text + ddlTempType.Text); //if (!task.IsCompleted) // task.Wait(); //Cursor = Cursors.Default; //var isSuccessed = task.IsSuccessed; //task.Close(); //if (!isSuccessed) // MsgBox.Warning("Sorry,Set Temp offset failed,please try again"); //else //{ // MsgBox.Warning("Set Temp offset successed"); // this.Close(); //} }