public static int GetDurability(Minion minion) { Durability durability = new Durability() { MinionGuid = minion.GUID, Magnitude = minion.InitialDurability }; DurabilityBoost(durability); return durability.Magnitude; }
public float RayCastOffset = 0f; //lateral offset for ray cast // Start is called before the first frame update void Start() { body = GetComponent <Rigidbody2D>(); body.gravityScale = 0f; //disable unity's control of gravity body.freezeRotation = true; //don't let teh physics system rotate things when they collide col = GetComponent <BoxCollider2D>(); col.isTrigger = true; dur = GetComponent <Durability>(); }
void Start() { rb = GetComponent <Rigidbody>(); rb.velocity = -transform.forward * movementData.speed; healthScript = GetComponent <Durability>(); currentSpeed = rb.velocity.z; StartCoroutine(Evade()); }
public InventoryItem(InventoryItem another) { name = another.name; type = another.type; databaseIndex = another.databaseIndex; durabilityInfo = new Durability(another.durabilityInfo); costInfo = new Cost(another.costInfo); bonusInfo = new Bonus(another.bonusInfo); uiInfo = new UIInfo(another.uiInfo); extraInfo = new Extra(another.extraInfo); }
public ItemDisplay() { InitializeComponent(); lblActiveItem.Text = ItemName; lblCost.Text = Cost.ToString(); lblSize.Text = ItemSize.ToString(); gridDetails.Rows.Clear(); if (Scope != null) { gridDetails.Rows.Add("Scope", Scope); } if (Damage_Prim != null) { gridDetails.Rows.Add("Primary", Damage_Prim); } if (Damage_Sec != null) { gridDetails.Rows.Add("Secondary", Damage_Sec); } if (Capacity != null) { gridDetails.Rows.Add("Capacity", Capacity); } if (Range != null) { gridDetails.Rows.Add("Range", Range); } if (Def_General > 0) { gridDetails.Rows.Add("General", Def_General.ToString()); } if (Def_Ballistic > 0) { gridDetails.Rows.Add("Ballistic", Def_Ballistic.ToString()); } if (Durability > 0) { gridDetails.Rows.Add("Durability", Durability.ToString()); } if (Structure > 0) { gridDetails.Rows.Add("Structure", Structure.ToString()); } gridDetails.ColumnHeadersVisible = false; txtDesc.Rtf = RtfHelper.PlainTextToRtf(Description); imgItem.ImageLocation = Properties.Settings.Default.DataLocation + @"Item_Images\" + Image; }
private void OnAttackHandler(object o, CollisionEventArgs e) { Debug.Log("JEB! Durability = " + Durability.ToString()); if (Durability > 0) { Durability -= DURABILITY_TAKEN_PER_HIT; if (Durability <= 0) { shatterHelper = true; } } }
public static float GetTrueDurability(this Durability @this, MinionResume resume = null) { if (isEquipped.Get(@this)) { float delta = GameClock.Instance.GetTimeInCycles() - @this.TimeEquipped; delta *= @this.durabilityLossPerCycle * difficultySettingMod.Get(@this); if (resume != null && resume.HasPerk(Db.Get().SkillPerks.ExosuitDurability.Id)) { delta *= 1f - EQUIPMENT.SUITS.SUIT_DURABILITY_SKILL_BONUS; } return(Mathf.Clamp01(durability.Get(@this) + delta)); } return(durability.Get(@this)); }
public IExchange DefineExchange( string name, ExchangeType exchangeType, Durability durablility = Durability.Durable, bool isAutoDelete = false) { var exchange = new Exchange(name, exchangeType) { IsAutoDelete = isAutoDelete, Durability = durablility }; exchanges.Add(exchange); return exchange; }
public IExchange DefineExchange( string name, ExchangeType exchangeType, Durability durablility = Durability.Durable, bool isAutoDelete = false) { var exchange = new Exchange(name, exchangeType) { IsAutoDelete = isAutoDelete, Durability = durablility }; exchanges.Add(exchange); return(exchange); }
public void BindToTime() { Durability health = GetComponent <Durability>(); float val = TimeController.instance.customSeconds / TimeController.instance.refreshRate; int flooredVal = Mathf.FloorToInt(val); int modifier = flooredVal * 4; expValue += modifier; if (health != null) { health.hitPoints += flooredVal; } }
void RPC_S2C_WeaponDurability(uLink.BitStream stream, uLink.NetworkMessageInfo info) { float hp = stream.Read <float>(); int objId = stream.Read <int>(); ItemObject item = ItemMgr.Instance.Get(objId); if (item != null) { Durability d = item.GetCmpt <Durability>(); if (d != null) { d.floatValue.current = hp; } } }
private List <string> GetFaultMessages() { var message = new List <string>(); if (Hopper.IsFull) { message.Add($"{Name} --The digger hopper is full."); } if (Durability.NeedsService()) { message.Add($"****** {Name} needs repair! ******"); } return(message); }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); facingRight = spriteRenderer.flipX; powerups = GetComponent <PowerUpCollector>(); durability = GetComponent <Durability>(); Physics2D.IgnoreLayerCollision(gameObject.layer, gameObject.layer); eggCount = maxEggCount; finiteFlight = maxFiniteFlight; sounds = GetComponent <SoundBank>(); animator = GetComponent <Animator>(); boostSpeed = jumpSpeed * boostFactor; }
public ChipDiggerState GetState() { return(new ChipDiggerState { Name = Name, LastDig = lastDig, FirstEquipped = FirstEquipped, DiggerBit = DiggerBit.GetState(), Durability = Durability.GetState(), Upgrades = AvailableUpgrades, Hopper = Hopper.GetState(), MineClaim = new MineClaimState { ChipDensity = MineClaim.ChipDensity, Hardness = MineClaim.Hardness }, LifeTimeStats = LifetimeStats }); }
void Awake() { //get the components animator = GetComponent <Animator> (); boxCollider = GetComponent <BoxCollider2D> (); durability = GetComponent <Durability> (); lifter = GetComponent <Lifter> (); rigidBody = GetComponent <Rigidbody2D> (); spriteRenderer = GetComponent <SpriteRenderer> (); //get the sword swordDamager = transform.GetChild(0).gameObject; //set up the internals speed = 0.79f; durability.maxHealthPoints = 12; durability.healthPoints = 12; durability.invincibleWindow = 0.5f; //set callbacks Durability.callback onDmg = durability.onDamaged; durability.onDamaged = (int diff) => { if (onDmg != null) { onDmg(diff); } FlashColor(1, 0, 0, 0.1f); }; Durability.callback onHld = durability.onHealed; durability.onHealed = (int diff) => { if (onHld != null) { onHld(diff); } FlashColor(0, 1, 0, 0.1f); }; }
public void SetDurabilityBg(ItemObject obj) { if (mDurabilitySpecial == null) { return; } if (obj == null) { mDurabilitySpecial.alpha = 0; return; } Durability dur = obj.GetCmpt <Durability>(); if (dur != null) { mDurabilitySpecial.alpha = 1 - dur.value.current / dur.valueMax; } else { mDurabilitySpecial.alpha = 0; } }
void Awake() { health.SetValues(); player = FindObjectOfType <PlayerController>(); fire = FindObjectOfType <FireManager>(); turret = FindObjectOfType <BaseTurret>(); wall = FindObjectOfType <Durability>(); targetManager = FindObjectOfType <EnemyTargetManager>(); dayRef = FindObjectOfType <DayNightCycle>(); agent = GetComponent <NavMeshAgent>(); attackRadius = GetComponent <CapsuleCollider>(); agent.speed = moveSpeed; attackRadius.radius = attackRange; attackRadius.height = attackRange; foreach (GameObject waypoint in GameObject.FindGameObjectsWithTag("Waypoint")) { wayPoints.Add(waypoint); } chosenWayPoint = Random.Range(0, wayPoints.Count); targetWayPoint = wayPoints[chosenWayPoint].transform.position; }
/// <summary> /// Class to hold the weapon bonus attributes and chances /// </summary> /// <param name="damageContainer">container with all possible types of damage related bonus and their chances.</param> /// <param name="accuracyContainer">container with all possible types of accuracy related bonus and their chances.</param> /// <param name="durabilityContainer">container with all possible types of durability related bonus and their chances.</param> public WeapMod(Damage damageContainer, Accuracy accuracyContainer, Durability durabilityContainer) { m_DamageContainer = damageContainer; m_AccuracyContainer = accuracyContainer; m_DurabilityContainer = durabilityContainer; }
/// <summary> /// Class to hold the weapon bonus attributes and chances /// </summary> /// <param name="accuracyContainer">container with all possible types of accuracy related bonus and their chances.</param> /// <param name="durabilityContainer">container with all possible types of durability related bonus and their chances.</param> public WeapMod(Accuracy accuracyContainer, Durability durabilityContainer) : this(null, accuracyContainer, durabilityContainer) { }
/// <summary> /// Class to hold the weapon bonus attributes and chances /// </summary> /// <param name="damageContainer">container with all possible types of damage related bonus and their chances.</param> /// <param name="durabilityContainer">container with all possible types of durability related bonus and their chances.</param> public WeapMod(Damage damageContainer, Durability durabilityContainer) : this(damageContainer, null, durabilityContainer) { }
public EntityId(EntityType type, Guid guid, Durability durability) { this.Type = type; this.Guid = guid; this.Durability = durability; }
/// <summary> /// FX for when attackers besiege the wall, and draw a card that does not exceed its strength. /// </summary> public void NoDamageEffects() { if (Durability > 0) { Vector3 guardPosition = transform.Find(MOVABLES_ORGANIZER).Find(GUARD_LABEL + Durability.ToString()).localPosition; noDamageParticle.transform.localPosition = new Vector3(guardPosition.x, noDamageParticle.transform.localPosition.y, noDamageParticle.transform.localPosition.z); noDamageParticle.SetActive(false); noDamageParticle.SetActive(true); } }
public InventoryItem(InventoryItem another) { name = another.name; type = another.type; databaseIndex = another.databaseIndex; durabilityInfo = new Durability(another.durabilityInfo); costInfo = new Cost(another.costInfo); bonusInfo = new Bonus(another.bonusInfo); uiInfo = new UIInfo(another.uiInfo); extraInfo = new Extra (another.extraInfo); }
public void Attack() { attackRay.origin = transform.position - new Vector3(0f, 0.5f, 0f); attackRay.direction = transform.forward; if (targetsInRange[0] == true && health.CurValue > 0) { if (Physics.Raycast(attackRay, out attackHit)) { attackTimer += Time.deltaTime; if (attackTimer >= attackSpeed) { if (player.health.CurValue > 0) { player.TakeDamage(attackDamage, attackHit.point); } attackTimer = 0; } } } if (targetsInRange[1] == true && health.CurValue > 0) { if (Physics.Raycast(attackRay, out attackHit)) { attackTimer += Time.deltaTime; if (attackTimer >= attackSpeed) { if (fire.health.CurValue > 0) { fire.TakeDamage(attackDamage, attackHit.point); } attackTimer = 0; } } } if (targetsInRange[2] == true && health.CurValue > 0) { if (Physics.Raycast(attackRay, out attackHit)) { BaseTurret turretHealth = attackHit.collider.GetComponent <BaseTurret>(); attackTimer += Time.deltaTime; if (attackTimer >= attackSpeed) { if (turretHealth.health.CurValue > 0) { turretHealth.TakeDamage(attackDamage, attackHit.point); } attackTimer = 0; } } } if (targetsInRange[3] == true && health.CurValue > 0) { if (Physics.Raycast(attackRay, out attackHit)) { Durability wallHealth = attackHit.collider.GetComponent <Durability>(); attackTimer += Time.deltaTime; if (attackTimer >= attackSpeed) { if (wallHealth != null) { wallHealth.TakeDamage(attackDamage, attackHit.point); } attackTimer = 0; } } } }
public Durability(Durability another) { current = another.current; max = another.max; }
public static bool IsTrueWornOut(this Durability @this, MinionResume resume = null) { return(@this.GetTrueDurability(resume) <= 0f); }
//alter the strength of this wall, and trigger associated feedback public void ChangeDurability(int change) { if (Durability > 0) { Vector3 guardPosition = transform.Find(MOVABLES_ORGANIZER).Find(GUARD_LABEL + Durability.ToString()).localPosition; guardHitParticle.transform.localPosition = new Vector3(guardPosition.x, guardHitParticle.transform.localPosition.y, guardHitParticle.transform.localPosition.z); guardHitParticle.SetActive(false); guardHitParticle.SetActive(true); Services.Tasks.AddTask(new GuardFallTask(transform.Find(MOVABLES_ORGANIZER).Find(GUARD_LABEL + Durability.ToString()).GetComponent <Rigidbody>())); Durability += change; } }
public void GenerateWeapon() { int typeSelect = Random.Range(0, 6); weaponName = weaponTypes[typeSelect]; int classSelect = Random.Range(0, 4); Class = classTypes[classSelect]; int modSelect = Random.Range(0, 10); modName = Modifier[modSelect]; int modSelect2 = Random.Range(0, 10); modName2 = Modifier2[modSelect2]; if (Random.Range(0, 2) == 1) { UniqueType = true; } else { UniqueType = false; } if (UniqueType) { int uniqueSelect = Random.Range(0, 6); myUniqueTypes = uniqueNames[uniqueSelect]; } else { myUniqueTypes = ""; } weaponName = weaponTypes[typeSelect] + myUniqueTypes; if (weaponTypes [typeSelect] == " Axe") { DamageStat = Random.Range(50, 70); Cost = Random.Range(30, 50); SpeedStat = Random.Range(5, 20); Durability = Random.Range(20, 40); Class = classTypes[classSelect]; modName = Modifier[modSelect]; modName2 = Modifier2[modSelect2]; } else if (weaponTypes [typeSelect] == " Sword") { DamageStat = Random.Range(30, 50); Cost = Random.Range(25, 40); SpeedStat = Random.Range(10, 30); Durability = Random.Range(20, 40); Class = classTypes[classSelect]; modName = Modifier[modSelect]; modName2 = Modifier2[modSelect2]; } else if (weaponTypes [typeSelect] == " Dagger") { DamageStat = Random.Range(20, 40); Cost = Random.Range(5, 20); SpeedStat = Random.Range(20, 50); Durability = Random.Range(30, 40); Class = classTypes[classSelect]; modName = Modifier[modSelect]; modName2 = Modifier2[modSelect2]; } else if (weaponTypes [typeSelect] == " Shield") { DamageStat = Random.Range(5, 10); Cost = Random.Range(30, 60); SpeedStat = Random.Range(0, 10); Durability = Random.Range(60, 80); Class = classTypes[classSelect]; modName = Modifier[modSelect]; modName2 = Modifier2[modSelect2]; } else if (weaponTypes [typeSelect] == " Mace") { DamageStat = Random.Range(20, 30); Cost = Random.Range(20, 40); SpeedStat = Random.Range(30, 50); Durability = Random.Range(20, 50); Class = classTypes[classSelect]; modName = Modifier[modSelect]; modName2 = Modifier2[modSelect2]; } else if (weaponTypes [typeSelect] == " Crossbow") { DamageStat = Random.Range(30, 45); Cost = Random.Range(30, 45); SpeedStat = Random.Range(30, 50); Durability = Random.Range(10, 30); Class = classTypes[classSelect]; modName = Modifier[modSelect]; modName2 = Modifier2[modSelect2]; } weaponNameTextObj.GetComponent <Text>().text = weaponName; classText.GetComponent <Text>().text = Class; damageText.GetComponent <Text>().text = DamageStat.ToString() + " %Bonus Damage"; costText.GetComponent <Text>().text = Cost.ToString() + " Gold"; durabilityText.GetComponent <Text>().text = Durability.ToString() + " %Bonus Durability"; speedText.GetComponent <Text>().text = SpeedStat.ToString() + " %Bonus Speed"; modifierText.GetComponent <Text> ().text = modName; modifier2Text.GetComponent <Text> ().text = modName2; }
public Exchange WithDurability(Durability durability) { Durability = durability; return(this); }
public static bool EquipCanAttack(PeEntity npc, ItemObject obj) { if (obj == null) { return(false); } if (obj.protoData.weaponInfo == null) { return(false); } if (obj.protoData.weaponInfo.attackModes == null) { return(false); } if (obj.protoData.weaponInfo.attackModes[0].damage <= PETools.PEMath.Epsilon) { return(false); } if (npc.NpcCmpt == null) { return(false); } if (!npc.NpcCmpt.HasConsume) { return(true); } //bow can not use in water bool npcFeetInwater = npc.biologyViewCmpt != null && npc.biologyViewCmpt.monoPhyCtrl != null ? npc.biologyViewCmpt.monoPhyCtrl.feetInWater : false; if (npcFeetInwater && obj.protoData.weaponInfo.costItem == SupplyNum.ARROW) { return(false); } Durability durability = obj.GetCmpt <ItemAsset.Durability>(); if (durability != null && durability.floatValue.current < PETools.PEMath.Epsilon) { return(false); } if (obj.protoData.weaponInfo.useEnergry) { if (npc.GetAttribute(AttribType.Energy) > 10.0f) { return(true); } Energy enery = obj.GetCmpt <Energy>(); bool objHasEnergy = enery != null && enery.floatValue.current > 10.0f; if (objHasEnergy) { return(true); } GunAmmo ammo = obj.GetCmpt <GunAmmo>(); bool hasAmmo = ammo != null && ammo.count > 5; if (hasAmmo) { return(true); } List <ItemAsset.ItemObject> objs = npc.GetEquipObjs(EeqSelect.energy); for (int i = 0; i < objs.Count; i++) { Energy enery0 = objs[i].GetCmpt <Energy>(); if (enery0 != null && enery0.floatValue.current > 10.0f) { return(true); } } return(false); } if (obj.protoData.weaponInfo.costItem > 0) { GunAmmo ammo = obj.GetCmpt <GunAmmo>(); return((ammo != null && ammo.count > 0) || npc.GetItemCount(obj.protoData.weaponInfo.costItem) > 0); } return(true); }
public static void Postfix(ref Durability __instance) { __instance.durabilityLossPerCycle = Settings.Instance.durabilityLossPerCycle; }
/// <summary> /// Class to hold the weapon bonus attributes and chances /// </summary> /// <param name="durabilityContainer">container with all possible types of durability related bonus and their chances.</param> public WeapMod(Durability durabilityContainer) : this(null, null, durabilityContainer) { }
void Start() { pc = GetComponent <PlayerController>(); dr = GetComponent <Durability>(); originalScale = transform.localScale.x; }