public Entity(Data data, Resist resist, V3 cors, IntPtr address) { this.d = data; this.res = resist; this.cors = cors; this.address = address; }
public FormIncrement() { InitializeComponent(); pData = new Classe(); IncrementTab = new Increment(); //muda o modo de edição para incremento BasicTab = new Basic(); BasicTab.IsClasseMode = false; StatTab = new BaseStat(); VitalTab = new Vital(); PhysicalTab = new Physical(); MagicTab = new Magic(); ExtraTab = new Extra(); ElementalTab = new Elemental(); ResistTab = new Resist(); DockPanel.AddContent(BasicTab); DockPanel.AddContent(StatTab); DockPanel.AddContent(VitalTab); DockPanel.AddContent(PhysicalTab); DockPanel.AddContent(MagicTab); DockPanel.AddContent(ElementalTab); DockPanel.AddContent(ResistTab); DockPanel.AddContent(ExtraTab); DockPanel.ContentRemoved += DockPanel_ContentRemoved; }
/// <summary> /// Calculates how susceptible something is based on the current /// resistances (<see cref="Immune"/> etc). This overload lets you /// omit item adjectives /// </summary> /// <param name="a"></param> /// <param name="includeItems">True to include items you are carrying when /// considering if you meet the immunities</param> /// <returns>0 for immunity, 1 for normal. 0.5 for resist and 2 for vulnerable</returns> public double Calculate(IActor a, bool includeItems) { //if you are immune if (Immune.Any(i => a.Has(i, includeItems))) { return(0); } bool resist = Resist.Any(i => a.Has(i, includeItems)); bool vuln = Vulnerable.Any(i => a.Has(i, includeItems)); if (resist && vuln) { return(1); } if (resist) { return(0.5); } if (vuln) { return(2); } //neither resistant nor vulnerable return(1); }
/// <summary> /// Calculates how susceptible something is based on the current /// resistances (<see cref="Immune"/> etc). /// </summary> /// <param name="s"></param> /// <returns>0 for immunity, 1 for normal. 0.5 for resist and 2 for vulnerable</returns> public double Calculate(IHasStats s) { //if you are immune if (Immune.Any(s.Has)) { return(0); } bool resist = Resist.Any(s.Has); bool vuln = Vulnerable.Any(s.Has); if (resist && vuln) { return(1); } if (resist) { return(0.5); } if (vuln) { return(2); } //neither resistant nor vulnerable return(1); }
public FormClasses() { InitializeComponent(); pData = new Classe(); IncrementTab = new Increment(); BasicTab = new Basic(); StatTab = new BaseStat(); VitalTab = new Vital(); PhysicalTab = new Physical(); MagicTab = new Magic(); ExtraTab = new Extra(); ElementalTab = new Elemental(); ResistTab = new Resist(); DockPanel.AddContent(BasicTab); DockPanel.AddContent(StatTab); DockPanel.AddContent(VitalTab); DockPanel.AddContent(PhysicalTab); DockPanel.AddContent(MagicTab); DockPanel.AddContent(ElementalTab); DockPanel.AddContent(ResistTab); DockPanel.AddContent(ExtraTab); DockPanel.ContentRemoved += DockPanel_ContentRemoved; }
private Dictionary <string, int> ParseResistance(string Resistance) { Resistance = Resistance.Replace(" and ", ","); Dictionary <string, int> tempDR = new Dictionary <string, int>(); List <string> tempResist = Resistance.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); tempResist = tempResist.Select(x => x.Trim()).ToList(); foreach (string Resist in tempResist) { try { int Pos = Resist.LastIndexOf(PathfinderConstants.SPACE); int value = int.Parse(Resist.Substring(Pos)); string temp = Resist.Replace(value.ToString(), string.Empty).Trim(); tempDR.Add(temp, value); } catch { continue; } } return(tempDR); }
public bool HasResist(Resist res) { if (resists.Contains(res)) { return(true); } return(false); }
public static float CalculateDefense(Type type, Source source, Resist resist) { float typeDefense; float sourceDefense; switch (type) { case Type.Physical: typeDefense = resist.physResist; break; case Type.Lightning: typeDefense = resist.lightningResist; break; case Type.Cold: typeDefense = resist.coldResist; break; case Type.Fire: typeDefense = resist.fireResist; break; case Type.Chaos: typeDefense = resist.chaosResist; break; default: typeDefense = 0; break; } switch (source) { case Source.Melee: sourceDefense = resist.meleeResist; break; case Source.Ranged: sourceDefense = resist.rangedResist; break; case Source.Siege: sourceDefense = resist.siegeResist; break; default: sourceDefense = 0; break; } float defense = typeDefense + sourceDefense; if (defense > 1) { defense = 1; } return(defense); }
public void Awake() { cB = GetComponent <CombatChar>(); foreach (Attributes attr in System.Enum.GetValues(typeof(Attributes))) { Attribute attribute = new Attribute(attr.ToString(), this); this.attributes.Add(attr, attribute); //Debug.Log(attr+ " " +this.getFlatValue(attr)); } foreach (Skills sk in System.Enum.GetValues(typeof(Skills))) { Skill skill = new Skill(sk.ToString(), this); this.skills.Add(sk, skill); //Debug.Log(sk); } foreach (string def in GlobalData.Defenses) { Defense defense = new Defense(def); this.defenses.Add(defense.name, defense); //Debug.Log(def); } foreach (string res in GlobalData.Resists) { Resist resist = new Resist(res); this.resists.Add(resist.name, resist); //Debug.Log(res); } foreach (Slots slot in System.Enum.GetValues(typeof(Slots))) { this.equipment.Add(slot, null); //Debug.Log(slot); } foreach (string prop in GlobalData.Properties) { Property property = new Property(prop); this.properties.Add(property.name, property); //Debug.Log(prop); } foreach (Properties prop in System.Enum.GetValues(typeof(Properties))) { Property property = new Property(prop.ToString()); this.Properties.Add(prop, property); //Debug.Log(attr+ " " +this.getFlatValue(attr)); } //inventory = new Inventory(this); life = maxLife(); Power pow = Resources.Load <GoblinPunch>("Goblin Punch") as Power; knownPowers.Add(pow.name, pow); pow = Resources.Load <Heal>("Heal") as Power; knownPowers.Add(pow.name, pow); pow = Resources.Load <Poison>("Poison") as Power; knownPowers.Add(pow.name, pow); }
private void OnTriggerStay(Collider other) { //전력을 받는다 if (other.tag == "Line") { Connect = true; Line = other.gameObject.GetComponentInParent <LineManager>(); LineObject = other.gameObject.GetComponent <Transform>(); LineCheck = true; OnArround(false); if (Line.parent != null) { if (Line.parent.tag == "DIGITAL") { ledmanager.DigitalConnect = true; } else if (Line.parent.tag == "BreadDIGITAL") { ledmanager.DigitalConnect = true; } else if (Line.parent.tag == "resister") { resi = Line.parent.GetComponent <Resist>(); ledmanager.power = resi.Power; if (resi.LineParent.tag == "DIGITAL") { ledmanager.DigitalConnect = true; } } //================================================ //else if (LineCheck == true) //{ // OnArround(true); // Connect = false; //} //================================================ ledmanager.power = Line.Power; } //배터리와 연결 완료 시 if (Line.ConnectSuccese == 1 && Line.ConnectBattery == true && circuitManager.Connecting == true) { circuitManager.ConnectElectro = Electro; } } }
// Start is called before the first frame update void Start() { resi = this.gameObject.GetComponentInParent <Resist>(); }
private void OnTriggerStay(Collider other) { switch (other.tag) { case "DIGITAL": Manager.Connect1 = 1; socket = other.gameObject; Manager.DigitalConnect = true; Manager.parent = other.gameObject; Manager.Power = 1; break; case "GND": Manager.Connect1 = 1; socket = other.gameObject; Manager.GNDConnect = true; Manager.parent = other.gameObject; break; case "VCC": Manager.Connect1 = 1; socket = other.gameObject; Manager.VccConnect = true; Manager.parent = other.gameObject; if (other.name == "5V") { Manager.Power = 5; } else if (other.name == "3V") { Manager.Power = 3; } break; case "ANALOG": Manager.Connect1 = 1; socket = other.gameObject; Manager.parent = other.gameObject; break; case "INPUT": Manager.Connect1 = 1; if (other.name == "EPPlus") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <LEDManager>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <LEDManager>().Pause); pm = other.GetComponent <EPPlus>(); Manager.type = GameManager.SensorType.Led; } else if (other.name == "EPMinus") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <LEDManager>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <LEDManager>().Pause); pm = other.GetComponent <EPMinus>(); } else if (other.name == "LegMin") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <SoundParent>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <SoundParent>().Pause); pm = other.GetComponent <SoundGND>(); } else if (other.name == "LegIO") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <SoundParent>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <SoundParent>().Pause); pm = other.GetComponent <SoundDigital>(); Manager.type = GameManager.SensorType.Sound; } else if (other.name == "LegPlus") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <SoundParent>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <SoundParent>().Pause); pm = other.GetComponent <SoundVCC>(); } else if (other.name == "UltPinVCC") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <UltValue>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <UltValue>().Pause); pm = other.GetComponent <UltVCC>(); } else if (other.name == "UltPinSig") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <UltValue>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <UltValue>().Pause); pm = other.GetComponent <UltSig>(); Manager.ultRead = other.gameObject.GetComponentInParent <UltValue>().Read; // Manager.type = GameManager.SensorType.Ult; } else if (other.name == "UltPinEcho") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <UltValue>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <UltValue>().Pause); pm = other.GetComponent <UltEcho>(); Manager.ultRead = other.gameObject.GetComponentInParent <UltValue>().Read; Manager.type = GameManager.SensorType.Ult; } else if (other.name == "UltPinGND") { Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <UltValue>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <UltValue>().Pause); pm = other.GetComponent <UltGND>(); } else if (other.name == "DCPinPlus") { Manager.parent = other.gameObject; Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <DCPlus>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <DCPlus>().Pause); l298ndigi = other.GetComponent <DCPlus>(); Manager.type = GameManager.SensorType.DC; } else if (other.name == "DCPinMin") { Manager.parent = other.gameObject; Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <DCMin>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <DCMin>().Pause); l298ndigi = other.GetComponent <DCMin>(); } else if (other.name == "TempMin") { pm = other.GetComponent <TempHumiGND>(); } else if (other.name == "TempDig") { pm = other.GetComponent <TempHumiDigital>(); Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <TempHumiParent>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <TempHumiParent>().Pause); // ==========새로 만든 코드 ===============// Manager.type = GameManager.SensorType.HumiTemp; Manager.humitempRead = other.gameObject.GetComponentInParent <TempHumiParent>().Read; } else if (other.name == "TempPlus") { pm = other.GetComponent <TempHumiVCC>(); } else if (other.name == "IllPinOUT") { pm = other.GetComponent <IllOUT>(); Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <lightSensor>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <lightSensor>().Pause); //// ==== 새로 만든 코드 ======// Manager.type = GameManager.SensorType.Lux; Manager.luxRead = other.gameObject.GetComponentInParent <lightSensor>().Read; } else if (other.name == "IllPinVCC") { pm = other.GetComponent <IllVCC>(); } else if (other.name == "IllPinGND") { pm = other.GetComponent <IllGND>(); } else if (other.name == "SignalPin") //수위센서 { pm = other.GetComponent <WaterSig>(); Manager.run = new LineManager.RunDelegate(other.gameObject.GetComponentInParent <WaterValue>().Run); Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent <WaterValue>().Pause); Manager.type = GameManager.SensorType.water; Manager.waterRead = other.gameObject.GetComponentInParent <WaterValue>().Read; } else if (other.name == "PlusPin") { pm = other.GetComponent <WaterVcc>(); } else if (other.name == "MinusPin") { pm = other.GetComponent <WaterGnd>(); } break; case "OUTPUT": Manager.Connect1 = 1; if (other.name == "SubPinSig") { Manager.servorun = new LineManager.RunServo(other.gameObject.GetComponentInParent <ServoManager>().Run); // Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent<SpinSub>().Pause); pm = other.GetComponent <SubSig>(); Manager.type = GameManager.SensorType.Servo; } else if (other.name == "SubPinPlus") { Manager.servorun = new LineManager.RunServo(other.gameObject.GetComponentInParent <ServoManager>().Run); // Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent<SpinSub>().Pause); pm = other.GetComponent <SubPlus>(); } else if (other.name == "SubPinMin") { Manager.servorun = new LineManager.RunServo(other.gameObject.GetComponentInParent <ServoManager>().Run); // Manager.pause = new LineManager.PauseDelegate(other.gameObject.GetComponentInParent<SpinSub>().Pause); pm = other.GetComponent <SubMin>(); } break; case "L298N_OUT": Manager.Connect1 = 1; l298n = other.GetComponent <L298NOUT4>(); Manager.L298N_OUTCONNECT = true; break; case "L298N_GND": Manager.Connect1 = 1; l298n_gnd = other.GetComponent <L298N_GND>(); break; case "L298N_VCC": Manager.Connect1 = 1; if (other.name == "12V") { l298n_vcc12 = other.GetComponent <L298N_VCC12v>(); } else if (other.name == "5V") { l298n_vcc5 = other.GetComponent <L298N_VCC5v>(); } break; case "L298N_DIGITAL": if (other.name == "OUT1PIN") { l298ndigi = other.GetComponent <L298N_DIGITAL>(); Manager.run = new LineManager.RunDelegate(l298ndigi.Run); Manager.pause = new LineManager.PauseDelegate(l298ndigi.Pause); Manager.type = GameManager.SensorType.l298n; } else if (other.name == "OUT2PIN") { l298ndigi = other.GetComponent <L298N_DIGITAL2>(); Manager.run = new LineManager.RunDelegate(l298ndigi.Run); Manager.pause = new LineManager.PauseDelegate(l298ndigi.Pause); Manager.type = GameManager.SensorType.l298n; } else if (other.name == "OUT3PIN") { l298ndigi = other.GetComponent <L298N_DIGITAL3>(); Manager.run = new LineManager.RunDelegate(l298ndigi.Run); Manager.pause = new LineManager.PauseDelegate(l298ndigi.Pause); Manager.type = GameManager.SensorType.l298n; } else if (other.name == "OUT4PIN") { l298ndigi = other.GetComponent <L298N_DIGITAL4>(); Manager.run = new LineManager.RunDelegate(l298ndigi.Run); Manager.pause = new LineManager.PauseDelegate(l298ndigi.Pause); Manager.type = GameManager.SensorType.l298n; } break; case "BreadPin": Manager.Connect1 = 1; //Manager.parent = other.gameObject; Manager.plusGroup = other.gameObject.GetComponentInParent <PlusGroup>(); pm = other.GetComponent <BreadBoardPin>(); Manager.type = GameManager.SensorType.Bread; break; case "BreadDIGITAL": Manager.Connect1 = 1; Manager.parent = other.gameObject; Manager.plusGroup = other.gameObject.GetComponentInParent <PlusGroup>(); pm = other.GetComponent <BreadBoardPin>(); Manager.type = GameManager.SensorType.Bread; break; case "BreadGND": Manager.Connect1 = 1; Manager.parent = other.gameObject; Manager.plusGroup = other.gameObject.GetComponentInParent <PlusGroup>(); pm = other.GetComponent <BreadBoardPin>(); break; case "BreadPlus": Manager.Connect1 = 1; Manager.parent = other.gameObject; Manager.plusGroup = other.gameObject.GetComponentInParent <PlusGroup>(); pm = other.GetComponent <BreadBoardPin>(); break; case "resister": Manager.Connect1 = 1; resi = other.GetComponentInParent <Resist>(); if (Manager.parent == null) { //저항이랑 모터 빵판 등등 연결되었을때 Manager.parent = other.gameObject; } else if (Manager.parent.tag == "DIGITAL") { if (resi != null) { //저항이랑 DIGITAL이 연결되었을떄 if (resi.run != null) { Manager.run = new LineManager.RunDelegate(resi.run); } if (resi.servorun != null) { Manager.servorun = new LineManager.RunServo(resi.servorun); } if (resi.plusgroup != null) { Manager.plusGroup = resi.plusgroup; } } } break; } }
public virtual void InvalidateDesc() { var name = Resist.ToString().SpaceWords().ToUpperWords(); Desc = String.Format("{0} {1} Resistance By {2}%", Offset >= 0 ? "Increase" : "Decrease", name, Offset); }