// This is where specific monsters will be given a pre-defined weapon object for purposes of the rest of the formula, based on their level and sprite weapon appearance. public static DaggerfallUnityItem MonsterWeaponAssign(DaggerfallEntity attacker) { EnemyEntity AIAttacker = null; AIAttacker = attacker as EnemyEntity; switch (AIAttacker.CareerIndex) { case (int)MonsterCareers.SkeletalWarrior: return(ItemBuilder.CreateWeapon(Weapons.War_Axe, WeaponMaterialTypes.Steel)); case (int)MonsterCareers.Orc: return(ItemBuilder.CreateWeapon(Weapons.Saber, WeaponMaterialTypes.Iron)); case (int)MonsterCareers.OrcSergeant: return(ItemBuilder.CreateWeapon(Weapons.Battle_Axe, WeaponMaterialTypes.Steel)); case (int)MonsterCareers.OrcWarlord: case (int)MonsterCareers.Daedroth: return(ItemBuilder.CreateWeapon(Weapons.Battle_Axe, WeaponMaterialTypes.Orcish)); case (int)MonsterCareers.OrcShaman: case (int)MonsterCareers.Lich: case (int)MonsterCareers.AncientLich: return(ItemBuilder.CreateWeapon(Weapons.Staff, WeaponMaterialTypes.Adamantium)); case (int)MonsterCareers.Centaur: return(ItemBuilder.CreateWeapon(Weapons.Claymore, WeaponMaterialTypes.Elven)); case (int)MonsterCareers.Giant: return(ItemBuilder.CreateWeapon(Weapons.Warhammer, WeaponMaterialTypes.Steel)); case (int)MonsterCareers.Gargoyle: return(ItemBuilder.CreateWeapon(Weapons.Flail, WeaponMaterialTypes.Steel)); case (int)MonsterCareers.IronAtronach: return(ItemBuilder.CreateWeapon(Weapons.Mace, WeaponMaterialTypes.Steel)); case (int)MonsterCareers.IceAtronach: return(ItemBuilder.CreateWeapon(Weapons.Katana, WeaponMaterialTypes.Elven)); case (int)MonsterCareers.Wraith: return(ItemBuilder.CreateWeapon(Weapons.Saber, WeaponMaterialTypes.Mithril)); case (int)MonsterCareers.FrostDaedra: return(ItemBuilder.CreateWeapon(Weapons.Warhammer, WeaponMaterialTypes.Daedric)); case (int)MonsterCareers.FireDaedra: case (int)MonsterCareers.DaedraLord: return(ItemBuilder.CreateWeapon(Weapons.Broadsword, WeaponMaterialTypes.Daedric)); default: return(null); } }
// This is where specific monsters will be given a pre-defined shield object for purposes of the rest of the formula, based on their level and sprite weapon appearance. public static DaggerfallUnityItem MonsterShieldAssign(DaggerfallEntity attacker) { EnemyEntity AIAttacker = null; AIAttacker = attacker as EnemyEntity; switch (AIAttacker.CareerIndex) { case (int)MonsterCareers.SkeletalWarrior: return(ItemBuilder.CreateArmor(Genders.Male, Races.Breton, Armor.Round_Shield, ArmorMaterialTypes.Steel)); default: return(null); } }
// This is where specific monsters will be given a true or false, depending on if said monster is clearly holding a type of shield in their sprite. public static bool SpecialShieldCheckForMonsters(DaggerfallEntity attacker) { EnemyEntity AIAttacker = null; AIAttacker = attacker as EnemyEntity; switch (AIAttacker.CareerIndex) { case (int)MonsterCareers.SkeletalWarrior: return(true); default: return(false); } }
public static bool EquipmentUser(EnemyEntity enemy) // Overload that can be used by outside scripts, probably a bit messy, but whatever it works. { if (enemy.EntityType == EntityTypes.EnemyClass) { return(true); } switch (enemy.CareerIndex) { case (int)MonsterCareers.Rat: case (int)MonsterCareers.GiantBat: case (int)MonsterCareers.GrizzlyBear: case (int)MonsterCareers.SabertoothTiger: case (int)MonsterCareers.Spider: case (int)MonsterCareers.Slaughterfish: case (int)MonsterCareers.GiantScorpion: case (int)MonsterCareers.Imp: case (int)MonsterCareers.Spriggan: case (int)MonsterCareers.Nymph: case (int)MonsterCareers.Harpy: case (int)MonsterCareers.Dragonling: case (int)MonsterCareers.Dragonling_Alternate: case (int)MonsterCareers.Dreugh: case (int)MonsterCareers.Lamia: case (int)MonsterCareers.Werewolf: case (int)MonsterCareers.Wereboar: case (int)MonsterCareers.FireAtronach: case (int)MonsterCareers.IronAtronach: case (int)MonsterCareers.FleshAtronach: case (int)MonsterCareers.IceAtronach: case (int)MonsterCareers.Ghost: case (int)MonsterCareers.Mummy: case (int)MonsterCareers.DaedraSeducer: return(false); default: return(true); } }
/// <summary> /// Creates a loot container for enemies slain by the player. /// </summary> /// <param name="player">Player object, must have PlayerEnterExit attached.</param> /// <param name="enemy">Enemy object, must have EnemyMotor attached.</param> /// <param name="corpseTexture">Packed corpse texture index from entity summary.</param> /// <param name="loadID">Unique LoadID for save system.</param> /// <returns>DaggerfallLoot.</returns> public static DaggerfallLoot CreateLootableCorpseMarker(GameObject player, GameObject enemy, EnemyEntity enemyEntity, int corpseTexture, ulong loadID) { // Player must have a PlayerEnterExit component PlayerEnterExit playerEnterExit = player.GetComponent<PlayerEnterExit>(); if (!playerEnterExit) throw new Exception("CreateLootableCorpseMarker() player game object must have PlayerEnterExit component."); // Enemy must have an EnemyMotor component EnemyMotor enemyMotor = enemy.GetComponent<EnemyMotor>(); if (!enemyMotor) throw new Exception("CreateLootableCorpseMarker() enemy game object must have EnemyMotor component."); // Get parent by context Transform parent = null; if (GameManager.Instance.IsPlayerInside) { if (GameManager.Instance.IsPlayerInsideDungeon) parent = playerEnterExit.Dungeon.transform; else parent = playerEnterExit.Interior.transform; } else { parent = GameManager.Instance.StreamingTarget.transform; } // Get corpse marker texture indices int archive, record; EnemyBasics.ReverseCorpseTexture(corpseTexture, out archive, out record); // Find ground position below player Vector3 position = enemyMotor.FindGroundPosition(); // Create loot container DaggerfallLoot loot = CreateLootContainer( LootContainerTypes.CorpseMarker, InventoryContainerImages.Corpse2, position, parent, archive, record, loadID); // Set properties loot.LoadID = loadID; loot.LootTableKey = enemyEntity.MobileEnemy.LootTableKey; loot.playerOwned = false; loot.customDrop = true; // If dropped outside ask StreamingWorld to track loose object if (!GameManager.Instance.IsPlayerInside) { GameManager.Instance.StreamingWorld.TrackLooseObject(loot.gameObject); } return loot; }
/// <summary> /// Handle shared logic when player attacks entity. /// </summary> public void HandleAttackFromSource(DaggerfallEntityBehaviour sourceEntityBehaviour) { // Break "normal power" concealment effects on source if (sourceEntityBehaviour.Entity.IsMagicallyConcealedNormalPower) { EntityEffectManager.BreakNormalPowerConcealmentEffects(sourceEntityBehaviour); } // When source is player if (sourceEntityBehaviour == GameManager.Instance.PlayerEntityBehaviour) { PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; // Handle civilian NPC crime reporting if (EntityType == EntityTypes.CivilianNPC) { MobilePersonNPC mobileNpc = transform.GetComponent <MobilePersonNPC>(); if (mobileNpc) { // Handle assault or murder if (Entity.CurrentHealth > 0) { playerEntity.CrimeCommitted = PlayerEntity.Crimes.Assault; playerEntity.SpawnCityGuards(true); } else { if (!mobileNpc.IsGuard) { playerEntity.TallyCrimeGuildRequirements(false, 5); playerEntity.CrimeCommitted = PlayerEntity.Crimes.Murder; playerEntity.SpawnCityGuards(true); } else { playerEntity.CrimeCommitted = PlayerEntity.Crimes.Assault; playerEntity.SpawnCityGuard(mobileNpc.transform.position, mobileNpc.transform.forward); } // Disable when dead mobileNpc.Motor.gameObject.SetActive(false); } } } // Handle mobile enemy aggro if (EntityType == EntityTypes.EnemyClass || EntityType == EntityTypes.EnemyMonster) { // Make enemy aggressive to player EnemyMotor enemyMotor = transform.GetComponent <EnemyMotor>(); if (enemyMotor) { if (!enemyMotor.IsHostile) { GameManager.Instance.MakeEnemiesHostile(); } enemyMotor.MakeEnemyHostileToAttacker(GameManager.Instance.PlayerEntityBehaviour); } // Handle killing guards EnemyEntity enemyEntity = entity as EnemyEntity; if (enemyEntity.MobileEnemy.ID == (int)MobileTypes.Knight_CityWatch && entity.CurrentHealth <= 0) { playerEntity.TallyCrimeGuildRequirements(false, 1); playerEntity.CrimeCommitted = PlayerEntity.Crimes.Murder; } } } }
private void EntityBehaviour_OnSetEntity(DaggerfallEntity oldEntity, DaggerfallEntity newEntity) { if (oldEntity != null) { oldEntity.OnDeath -= EnemyEntity_OnDeath; } if (newEntity != null) { enemyEntity = newEntity as EnemyEntity; enemyEntity.OnDeath += EnemyEntity_OnDeath; ; } }