private string GetArmorInfo(IItem item) { IArmor armor = item as IArmor; if (armor != null) { StringBuilder strBldr = new StringBuilder(); IShield shield = item as IShield; if (shield != null) { strBldr.AppendLine("ShieldNegateDamagePercent: " + shield.NegateDamagePercent); } strBldr.AppendLine(DiceInfo(armor.Dice)); foreach (DamageType damageType in Enum.GetValues(typeof(DamageType))) { strBldr.AppendLine(damageType.ToString() + ": " + armor.GetTypeModifier(damageType)); } strBldr.Append(EquipmentInfo(armor)); return(strBldr.ToString()); } return(""); }
public void EquipOffhand(ItemClass item) { // If a shield is held if (heldOffhand != null) { // Add current offhand to inventory InventoryManager.instance.AddItemToInventory(currentHeldItem.itemSlug); // Remove offhand stats from player stats combatantStats.RemoveStatBoost(heldOffhand.GetComponent <IShield>().Stats); // Destroy offhand being held Destroy(offhand.transform.GetChild(0).gameObject); // Destroys first child of mainHand, which would be offhand held } // Equip new offhand heldOffhand = (GameObject)Instantiate(Resources.Load <GameObject>("Items/Offhands/" + item.itemSlug), offhand.transform.position, offhand.transform.rotation); // Finds prefab in resources folder with the same item slug and instantiates it on the main hand // Get offhand interface from the held offhand equippedOffhand = heldOffhand.GetComponent <IShield>(); // Set new offhand stats equippedOffhand.Stats = item.stats; // Set offhand position to mainhand heldOffhand.transform.SetParent(offhand.transform); // Set stats for equipped offhand equippedOffhand.Stats = item.stats; // Set current offhand to new offhand currentHeldItem = item; // Add offhand stats to player combatantStats.AddStatBoost(item.stats); // Pass item being equipped to UIManager UIManager.ShieldEquipped(item); UIManager.StatsChanged(); Debug.Log(equippedOffhand.Stats[0]); }
public static IEnumerable <Gizmo> Gizmos(IShield shield) { yield return(new Command_Action { icon = ContentFinder <Texture2D> .Get("UI/Commands/CopySettings"), defaultLabel = "CommandCopyZoneSettingsLabel".Translate(), defaultDesc = "CommandCopyZoneSettingsDesc".Translate(), hotKey = KeyBindingDefOf.Misc4, action = () => { SoundDefOf.Tick_High.PlayOneShotOnCamera(); _copied = shield.ShieldSettings.ToList(); } }); yield return(new Command_Action { icon = ContentFinder <Texture2D> .Get("UI/Commands/PasteSettings"), defaultLabel = "CommandPasteZoneSettingsLabel".Translate(), defaultDesc = "CommandPasteZoneSettingsDesc".Translate(), hotKey = KeyBindingDefOf.Misc5, action = () => { SoundDefOf.Tick_High.PlayOneShotOnCamera(); shield.ShieldSettings = _copied; } // disabled = _copied.Count > 0 }); }
public static Vector2 ShieldKnockbackVector(IAttackHitbox hitbox, IShield shield) { float pushAngle = FlipAngle(0.0f, hitbox.GetOwner(), shield.GetOwner()); Vector2 dir = (Vector2)(Quaternion.Euler(0, 0, pushAngle) * Vector2.right); return(dir * ShieldKnockbackStrength(hitbox, shield)); }
public void Del(Map map, IShield shield) { try { _shieldsMap[map.uniqueID].Remove(shield); } catch (KeyNotFoundException) {} }
public void Init() { AllComps.OfType <IEnergyNode>().Do(Connect); _flickable = GetComp <CompFlickable>(); _shield = ShieldUtility.FindComp(AllComps); _shield.SetParent(this); _heatSink = HeatsinkUtility.FindComp(AllComps); }
public override void SpawnSetup(Map map, bool respawningAfterLoad) { _energySource = EnergySourceUtility.Find(this); _shield = ShieldUtility.FindComp(this); _heatSink = HeatsinkUtility.FindComp(this); _activeLastTick = IsActive; base.SpawnSetup(map, respawningAfterLoad); }
public void TearDown() { myShield = null; myHealth = null; myEnergy = null; myOwnBot = null; myEnemyOne = null; myBattleField = null; enemiesCollection = null; sut = null; }
/// <summary> /// Creates a new instance of the player object. All base values set to /// defaults for those that have a default value. /// </summary> /// <param name="defaultSpeed"> /// The default speed value for our new instance. /// </param> /// <param name="defaultWeapon"> /// The default <see cref="IWeapon" /> for our new instance. /// </param> /// <param name="health"> /// The initial <see cref="IHealth" /> for our new instance. /// </param> /// <param name="shield"> /// The initial <see cref="Shield" /> for our new instance. /// </param> public Player(float defaultSpeed, IWeapon defaultWeapon, IHealth health, IShield shield = null) { _defaultSpeed = defaultSpeed; _defaultWeapon = defaultWeapon; _health = health; _shield = shield; _speed = _defaultSpeed; _weapon = _defaultWeapon; }
public static bool ItemProvidesShield(Thing item, IShield shield) { switch (item) { case IShield itemShield: return(shield == itemShield); case MinifiedThing minified: return(shield == minified.InnerThing); } return(false); }
private void Awake() { if (scriptableObject is IShield shield) { _shield = shield; } _shield.SetVariables(GetComponent <Health>(), shieldObj); _audioSource = gameObject.AddComponent <AudioSource>(); _audioSource.outputAudioMixerGroup = mixerGroup; _audioSource.volume = audioVolume; }
private IEquipment Shield() { IShield item = CreateShield(35, new Wood()); item.KeyWords.Add("Shield"); item.KeyWords.Add("Potato"); item.ShortDescription = "A large wooden kite shield with a potato painted on the front."; item.LookDescription = "The potato seems rather out of place as if the maker really liked potatoes."; item.ExamineDescription = "Standing four and half feet tall this shield is almost as tall as the shoppekeep."; item.SentenceDescription = "potato kite shield"; item.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForArmorLevel(item.Level); item.FinishLoad(); return(item); }
public void Add(Map map, IShield shield) { List <IShield> shields; try { shields = _shieldsMap[map.uniqueID]; } catch (KeyNotFoundException) { shields = new List <IShield>(); _shieldsMap.Add(map.uniqueID, shields); } shields.Add(shield); }
public void SetUp() { sut = new MySuperHero(); myShield = CreateAndSetupShield(); SetShieldPercentageAndActualShieldPoints(100); myHealth = CreateAndSetupHealth(); myEnergy = CreateAndSetupEnergy(); myOwnBot = CreateAndSetupOwnBot(OwnBotInitialPositionX, OwnBotInitialPositionY); myEnemyOne = CreateAndSetupEnemy(EnemyOneInitialPositionX, EnemyOneInitialPositionY); SetDistanceToEnemy(myEnemyOne); myBattleField = new Mock <IBattlefieldView>().Object; enemiesCollection = new List <IEnemy> { myEnemyOne }; }
// Start is called before the first frame update void Start() { hitboxes = new Dictionary <string, HitboxManager>(); HitboxManager[] list = GetComponentsInChildren <HitboxManager>(); foreach (HitboxManager hitbox in list) { hitboxes.Add(hitbox.name, hitbox); //Debug.Log(hitbox.name); } activatedHitboxes = new List <HitboxManager>(); shield = GetComponentInChildren <IShield>(); character = GetComponent <ICharacter>(); passive = GetComponent <RonPassive>(); }
public static void DeployShield(Pawn pawn, IShield shield) { var deployed = new Comp_DeployedShield(shield); deployed.props = new CompProperties_DeployedShield(); switch (shield) { case IEnergyNode node: node.ConnectTo(null); // TODO get pawn net break; } pawn.Map.GetComponent <ShieldManager>().Add(shield); pawn.AllComps.Add(deployed); }
internal Ship(string name, Vector2 position, float radius, Color color, IGraphicsFactory graphicsFactory, IShipComponentFactory shipComponentFactory) : base(position, radius, 1) { Name = name; Color = color; _controller = new NullShipController(); _energyStore = shipComponentFactory.CreateEnergyStore(); _shield = shipComponentFactory.CreateShield(this); _hull = shipComponentFactory.CreateHull(this); _thrusterArray = shipComponentFactory.CreateThrusterArray(this); _graphicsFactory = graphicsFactory; _arrows = new List<IArrow>(); }
private bool ShouldPassThrough(IShield shield, Vector3 position) { if (Mod.Settings.OverlapPassThrough) { foreach (var otherShield in Shields) { if (shield == otherShield) { continue; } if (otherShield.Collision(position)) { return(true); } } } return(false); }
public static void UndeployShield(Pawn pawn, IShield shield) { pawn.AllComps .Where(comp => comp == shield) .Do(comp => { pawn.AllComps.Remove(comp); }); switch (shield) { case IEnergyNode node: node.Disconnect(); break; } pawn.Map.GetComponent <ShieldManager>().Del(shield); }
static void Main(string[] args) { ISword Sword = Generator.Sword(); IShield Shield = Generator.Shield(); //Constructor DI Warrior warrior = Generator.MakeWarrior(Sword, Shield); Preparation p = Generator.MakePreperations(); p.BattlePreperation(); IDragon dragon = Generator.MakeDragon(p.dragonType); IBattle Battle = Generator.Battle(p.sword, p.shield); Battle.Clash(warrior, dragon); Battle.BattleOutcome(warrior, dragon); Console.ReadKey(); }
public void EquipShield(IShield shield) { _shield = shield; }
public static bool CanDeploy(Pawn pawn, IShield shield) { return(pawn.RaceProps.baseBodySize >= shield.DeploymentSize); }
public MagneticFieldAbility(IShield shield, GroupSettings settings) : base(shield) { this.field = (MagneticField)shield; this.settings = new MagneticFieldSettings(settings.Menu, shield); }
internal void setShield(IShield shield){ this.shield = shield; }
public static Warrior MakeWarrior(ISword sword, IShield shield) { return(new Warrior(100, sword, shield)); }
public virtual int TakeDamage(int totalDamage, IDamage damage, IMobileObject attacker) { GlobalReference.GlobalValues.Engine.Event.DamageReceivedBeforeDefense(attacker, this, totalDamage); int absoredDamage = 0; int stoppedDamage = 0; int mobReceivedDamage = 0; bool shieldBlocked = false; int healthBeforeDamage = Health; foreach (IArmor armor in EquipedArmor) { IShield shield = armor as IShield; if (shield != null) { int shieldNegateRoll = GlobalReference.GlobalValues.Random.Next(101); if (shieldNegateRoll <= shield.NegateDamagePercent) { shieldBlocked = true; } } int damageBlocked = CalculateDamageBlocked(armor); decimal damageTypeModifer = armor.GetTypeModifier(damage.Type); if (damageTypeModifer == decimal.MaxValue) { //we have an item that makes the user immune to the damage type //set the stopped damage = to the total damage stoppedDamage = totalDamage; } else if (damageTypeModifer >= 0) { //values 0-1 reduce the effectiveness of the armor //values > 1 increase the effectiveness of the armor //ie .5 reduces the damage blocked by half //ie 1.5 increase the damage blocked by 50% stoppedDamage += (int)(damageBlocked * damageTypeModifer); } //armor absorbs this damage into life else { //low negative number absorb a little life //high negative numbers absorb more life //ie -.5 absorbs half the blocked damage back as life //ie -1.5 absorbs 1.5 times the damage blocked back as life stoppedDamage += damageBlocked; absoredDamage += (int)(damageBlocked * damageTypeModifer); } } stoppedDamage += AddDefenseStatBonus(damage); //damage can not be negative int receivedDamage = Math.Max(0, totalDamage - stoppedDamage); if (shieldBlocked != true && receivedDamage > 0) { //this is damage that went through to the mob. //Multiply it by their race damage modifier and take the modified damage. mobReceivedDamage = (int)(receivedDamage * GetTypeModifier(damage.Type)); Health -= mobReceivedDamage; } //absoredDamage is negative because of the previous multipliers being negative //so we want to subtract the damage to make it positive Health -= absoredDamage; if (Health > MaxHealth) { Health = MaxHealth; } else if (Health <= 0 && healthBeforeDamage > 0) //don't let a mob die two or more times. { Die(); INonPlayerCharacter npc = this as INonPlayerCharacter; IPlayerCharacter pc = attacker as IPlayerCharacter; if (npc != null && attacker != null) { pc.Experience += npc.EXP; } } //return received damage minus any absorbed damage (it is negative so we add it) int netDamage = mobReceivedDamage + absoredDamage; GlobalReference.GlobalValues.Engine.Event.DamageReceivedAfterDefense(attacker, this, netDamage); return(netDamage); }
public void SetUp() { _graphicsFactory = Substitute.For<IGraphicsFactory>(); _graphicsDevice = Substitute.For<IGraphicsDevice>(); _shipComponentFactory = Substitute.For<IShipComponentFactory>(); _energyStore = Substitute.For<IEnergyStore>(); _shield = Substitute.For<IShield>(); _hull = Substitute.For<IHull>(); _thrusterArray = Substitute.For<IThrusterArray>(); _controller = Substitute.For<IShipController>(); _shipComponentFactory.CreateEnergyStore().ReturnsForAnyArgs(_energyStore); _shipComponentFactory.CreateShield(Arg.Any<IShip>()).Returns(_shield); _shipComponentFactory.CreateHull(Arg.Any<IShip>()).Returns(_hull); _shipComponentFactory.CreateThrusterArray(Arg.Any<IShip>()).Returns(_thrusterArray); _position = new Vector2(12f, 5.5f); _ship = new Ship("TestShip", _position, _radius, Color.Goldenrod, _graphicsFactory, _shipComponentFactory); _ship.SetController(_controller); }
public void SetParent(IShield shieldParent) { }
//Constructor DI public Warrior(int health, ISword sword, IShield shield) { this.health = health; _sword = sword; _shield = shield; }
// Token: 0x06000878 RID: 2168 RVA: 0x000063D5 File Offset: 0x000045D5 public OldShieldAbility(IShield ability) : base(ability) { this.Shield = ability; }
/// <summary> /// Creates a new instance of the Shield powerup! /// </summary> /// <param name="shield"> /// Instance of <see cref="IShield"/> to apply to player. /// </param> /// <param name="duration"> /// Duration to apply the buff for. /// </param> public ShieldPowerup(IShield shield, float?duration = 10f) { _buffDuration = duration; _shield = shield; }
public Inventory_Shield_Model(IShield shield, ItemSlot itemSlot){ this.shield = shield; this.itemSlot = itemSlot; }
public abstract void Add(IShield shield);
public abstract void Del(IShield shield);