コード例 #1
0
ファイル: EnemyData.cs プロジェクト: thelegend831/teleports
 public EnemyData(EnemyData other)
 {
     name     = other.name;
     raceId   = new RaceID(other.raceId);
     aiParams = new AiParameters(other.aiParams);
     items    = new List <ItemData>(other.items);
 }
コード例 #2
0
        public override void TileProc(int aX, int aY, ref bool refContinue)
        {
            NWField f = Field;

            Step(aX, aY);

            if (f.IsBarrier(aX, aY))
            {
                refContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null && c.HasAffect(EffectID.eid_Death))
                {
                    RaceID race = c.Entry.Race;
                    if (race == RaceID.crDefault || race == RaceID.crHuman)
                    {
                        if (c.IsPlayer)
                        {
                            c.Death(BaseLocale.GetStr(RS.rs_KilledByDeathRay), null);
                        }
                        else
                        {
                            c.Death(BaseLocale.Format(RS.rs_TheXIsDestroyed, new object[] { c.Name }), null);
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: HeroData.cs プロジェクト: thelegend831/teleports
 public void CorrectInvalidData()
 {
     if (raceId == null)
     {
         Debug.LogWarning("Race ID is null, changing to \"Human\"");
         raceId = new RaceID("Human");
     }
 }
コード例 #4
0
        private void PrepareEnemy()
        {
            try {
                NWCreature self = (NWCreature)fSelf;

                // search nearest enemy
                NWCreature enemy = self.FindEnemy();

                if (enemy != null)
                {
                    if (IsShipSail)
                    {
                        PrepareChase(enemy, AttackRisk.Wary, false);
                        return;
                    }

                    AttackRisk ar;

                    RaceID race = self.Entry.Race;
                    if (GlobalVars.Debug_Fury || race == RaceID.crAesir || race == RaceID.crEvilGod || race == RaceID.crDaemon)
                    {
                        ar = AttackRisk.Immediately;
                    }
                    else
                    {
                        bool vent = self.Effects.FindEffectByID(EffectID.eid_Ventriloquism) != null;
                        if (vent)
                        {
                            ar = AttackRisk.Wait;
                        }
                        else
                        {
                            float arVal = self.GetAttackRate(enemy, Kinsfolks.Count);
                            ar = GetRiskKind(arVal);
                        }
                    }

                    switch (ar)
                    {
                    case AttackRisk.RunAway:
                    case AttackRisk.Evade:
                        PrepareEvade(enemy, ar, true);
                        break;

                    case AttackRisk.Wait:
                        // dummy
                        break;

                    case AttackRisk.Wary:
                    case AttackRisk.Immediately:
                        PrepareChase(enemy, ar, true);
                        break;
                    }
                }
            } catch (Exception ex) {
                Logger.Write("BeastBrain.prepareEnemy(): " + ex.Message);
            }
        }
コード例 #5
0
ファイル: BaseCharacter.cs プロジェクト: pasketi/Dicey
    public virtual void CreateCharacter(RaceID race)
    {
        UpdateDefence(DefenceID.ArmorClass);
        UpdateDefence(DefenceID.Fortitude);
        UpdateDefence(DefenceID.Reflex);
        UpdateDefence(DefenceID.Will);
        UpdateMaxHealth();
        _currentHealth = _maxHealth;

        return;
    }
コード例 #6
0
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWField fld  = Field;
            NWTile  tile = (NWTile)fld.GetTile(aX, aY);

            Step(aX, aY);

            if (tile == null)
            {
                aContinue = false;
            }
            else
            {
                int fgp = tile.ForeBase;

                switch (fgp)
                {
                case PlaceID.pid_Undefined:
                    break;

                case PlaceID.pid_Mountain:
                case PlaceID.pid_Vulcan:
                    aContinue = false;
                    break;

                case PlaceID.pid_Vortex:
                case PlaceID.pid_StairsDown:
                case PlaceID.pid_StairsUp:
                case PlaceID.pid_GStairsDown:
                case PlaceID.pid_GStairsUp:
                case PlaceID.pid_HoleDown:
                case PlaceID.pid_HoleUp:
                    break;

                default:
                    tile.Foreground = PlaceID.pid_Rubble;
                    break;
                }

                NWCreature c = (NWCreature)fld.FindCreature(aX, aY);
                if (c != null)
                {
                    RaceID race = c.Entry.Race;
                    if (race == RaceID.crDefault || race == RaceID.crHuman)
                    {
                        c.Death("", null);
                    }
                }
            }
        }
コード例 #7
0
ファイル: GameState.cs プロジェクト: thelegend831/teleports
    public void CreateNewHero(string name, RaceID raceId)
    {
        if (CurrentHeroData != null && !CurrentHeroData.IsEmpty)
        {
            ErrorHandler.ReportError("Cannot create a new hero - slot already taken");
            return;
        }

        if (Main.StaticData.Game.Races.GetValue(raceId) == null)
        {
            ErrorHandler.ReportError("Cannot create a new hero - invalid race ID");
            return;
        }

        heroes[currentHeroId] = new HeroData(name, raceId);
        HeroChangedEvent?.Invoke();
    }
コード例 #8
0
 public HeroData(HeroData other)
 {
     isEmpty              = other.isEmpty;
     characterName        = other.characterName;
     raceId               = other.raceId;
     xp                   = other.xp;
     level                = other.level;
     rankPoints           = other.rankPoints;
     totalAttributePoints = other.totalAttributePoints;
     spentAttributePoints = other.spentAttributePoints;
     skillTreeSlots       = other.skillTreeSlots.DeepCopy();
     skills               = other.skills.DeepCopy();
     primarySkill         = new SkillID(other.primarySkill);
     secondarySkills      = other.secondarySkills.DeepCopy();
     unitData             = new UnitData(other.unitData);
     teleportData         = new TeleportData(other.teleportData);
 }
コード例 #9
0
ファイル: HeroData.cs プロジェクト: thelegend831/teleports
    public void Init(string name, RaceID raceId)
    {
        isEmpty       = false;
        characterName = name;
        this.raceId   = raceId;
        xp            = 0;
        level         = 1;
        rankPoints    = 0;
        Utils.InitWithNew(ref skillTreeSlots, StartingSkillSlotsCount);

        unitData        = Main.StaticData.Game.Races.GetValue(raceId).BaseStats;
        skills          = unitData.Skills;
        primarySkill    = unitData.MainAttack;
        secondarySkills = new List <SkillID>(StartingSecondarySkillsCount);

        teleportData = new TeleportData();
    }
コード例 #10
0
    private Collider FindExistingCollider()
    {
        Collider result = null;

        result = unit.GetComponent <Collider>();
        if (result != null)
        {
            return(result);
        }

        RaceID raceId = new RaceID(unit.UnitData.RaceName);

        result = Main.StaticData.Game.Races.GetValue(raceId).Graphics.Collider;
        if (result != null)
        {
            return(gameObject.AddCopyOfComponent(result));
        }

        //the collider must be in the same gameObject as the rigidbody, so if we find one in a child object, we move it up
        Collider childCollider = unit.GetComponentInChildren <Collider>();

        if (childCollider is BoxCollider)
        {
            result = gameObject.AddCopyOfComponent(childCollider as BoxCollider);
        }
        if (childCollider is SphereCollider)
        {
            result = gameObject.AddCopyOfComponent(childCollider as SphereCollider);
        }
        if (childCollider is CapsuleCollider)
        {
            result = gameObject.AddCopyOfComponent(childCollider as CapsuleCollider);
        }
        if (childCollider is MeshCollider)
        {
            result = gameObject.AddCopyOfComponent(childCollider as MeshCollider);
        }

        Destroy(childCollider);
        return(result);
    }
コード例 #11
0
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWField f = Field;

            Step(aX, aY);
            if (f.IsBarrier(aX, aY))
            {
                aContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null)
                {
                    RaceID race = c.Entry.Race;
                    if (race == RaceID.crDefault || race == RaceID.crHuman)
                    {
                        c.ClearAbilities();
                        c.ClearSkills();
                    }
                }
            }
        }
コード例 #12
0
        public override void Execute()
        {
            NWCreature self  = (NWCreature)Self;
            NWCreature enemy = (NWCreature)Enemy;

            bool   ex   = ((NWField)self.CurrentMap).Creatures.IndexOf(enemy) >= 0;
            RaceID race = self.Entry.Race;
            bool   los  = (race == RaceID.crDefault || race == RaceID.crHuman);

            IsComplete = (!ex || enemy.State == CreatureState.csDead || !self.IsAvailable(enemy, los));
            if (!IsComplete)
            {
                if (!CanMove)
                {
                    Brain.Attack(enemy, true);
                }
                else
                {
                    Brain.Attack(enemy, Risk == AttackRisk.ar_Wary);
                }

                IsComplete = (enemy.State == CreatureState.csDead);
            }
        }
コード例 #13
0
 public Race GetRace(RaceID raceId)
 {
     return(GetRace(raceId.Name));
 }
コード例 #14
0
        public override void LoadXML(XmlNode element, FileVersion version)
        {
            try {
                base.LoadXML(element, version);

                Race = (RaceID)Enum.Parse(typeof(RaceID), ReadElement(element, "Race"));
                Gfx  = ReadElement(element, "gfx");
                Sfx  = ReadElement(element, "sfx");

                string signs = ReadElement(element, "Signs");
                Flags = new CreatureFlags(signs);
                if (!signs.Equals(Flags.Signature))
                {
                    throw new Exception("CreatureSigns not equals " + Convert.ToString(GUID));
                }

                MinHP        = Convert.ToInt16(ReadElement(element, "minHP"));
                MaxHP        = Convert.ToInt16(ReadElement(element, "maxHP"));
                AC           = Convert.ToInt16(ReadElement(element, "AC"));
                Speed        = Convert.ToSByte(ReadElement(element, "Speed"));
                ToHit        = Convert.ToInt16(ReadElement(element, "ToHit"));
                Attacks      = Convert.ToSByte(ReadElement(element, "Attacks"));
                Constitution = Convert.ToInt16(ReadElement(element, "Constitution"));
                Strength     = Convert.ToInt16(ReadElement(element, "Strength"));
                MinDB        = Convert.ToInt16(ReadElement(element, "minDB"));
                MaxDB        = Convert.ToInt16(ReadElement(element, "maxDB"));
                Survey       = Convert.ToByte(ReadElement(element, "Survey"));
                Level        = Convert.ToSByte(ReadElement(element, "Level"));
                Alignment    = (Alignment)Enum.Parse(typeof(Alignment), ReadElement(element, "Alignment"));
                Weight       = (float)ConvertHelper.ParseFloat(ReadElement(element, "Weight"), 0.0f, true);
                Sex          = StaticData.GetSexBySign(ReadElement(element, "Sex"));

                FleshEffect  = Convert.ToInt32(ReadElement(element, "FleshEffect"));
                FleshSatiety = Convert.ToInt16(ReadElement(element, "FleshSatiety"));

                string sym = ReadElement(element, "Symbol");
                Symbol      = (string.IsNullOrEmpty(sym) ? '?' : sym[0]);
                Extinctable = Convert.ToBoolean(ReadElement(element, "Extinctable"));
                Dexterity   = Convert.ToUInt16(ReadElement(element, "Dexterity"));
                Hear        = Convert.ToByte(ReadElement(element, "Hear"));
                Smell       = Convert.ToByte(ReadElement(element, "Smell"));
                FramesCount = Convert.ToByte(ReadElement(element, "FramesCount"));

                XmlNodeList nl = element.SelectSingleNode("Lands").ChildNodes;
                Lands = new string[nl.Count];
                for (int i = 0; i < nl.Count; i++)
                {
                    XmlNode n = nl[i];
                    Lands[i] = n.Attributes["ID"].InnerText;
                }

                nl = element.SelectSingleNode("Abilities").ChildNodes;
                for (int i = 0; i < nl.Count; i++)
                {
                    XmlNode   n   = nl[i];
                    AbilityID ab  = (AbilityID)Enum.Parse(typeof(AbilityID), n.Attributes["ID"].InnerText);
                    int       val = Convert.ToInt32(n.Attributes["Value"].InnerText);
                    Abilities.Add((int)ab, val);
                }

                nl = element.SelectSingleNode("Skills").ChildNodes;
                for (int i = 0; i < nl.Count; i++)
                {
                    XmlNode n   = nl[i];
                    SkillID sk  = (SkillID)Enum.Parse(typeof(SkillID), n.Attributes["ID"].InnerText);
                    int     val = Convert.ToInt32(n.Attributes["Value"].InnerText);
                    Skills.Add((int)sk, val);
                }

                nl        = element.SelectSingleNode("Inventory").ChildNodes;
                Inventory = new InventoryEntry[nl.Count];
                for (int i = 0; i < nl.Count; i++)
                {
                    XmlNode n = nl[i];

                    InventoryEntry invEntry = new InventoryEntry();
                    Inventory[i]      = invEntry;
                    invEntry.ItemSign = n.Attributes["ID"].InnerText;
                    invEntry.CountMin = Convert.ToInt32(n.Attributes["CountMin"].InnerText);
                    invEntry.CountMax = Convert.ToInt32(n.Attributes["CountMax"].InnerText);

                    XmlAttribute stat = n.Attributes["Status"];
                    if (stat != null)
                    {
                        ParseStatus(invEntry, stat.InnerText);
                    }
                }

                XmlNodeList dnl = element.SelectNodes("Dialog");
                if (dnl.Count > 0)
                {
                    XmlNode dialogXmlNode = (XmlNode)dnl[0];
                    Dialog.LoadXML(dialogXmlNode, version, true);
                }
            } catch (Exception ex) {
                Logger.Write("CreatureEntry.loadXML(): " + ex.Message);
                throw ex;
            }
        }
コード例 #15
0
ファイル: HeroData.cs プロジェクト: thelegend831/teleports
 public HeroData(string name, RaceID raceId)
 {
     Init(name, raceId);
 }
コード例 #16
0
        public RaceSkillConditionalFeat SaveRaceSkillConditionalFeat()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_RaceSkillConditionalFeat";
                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceID", SqlDbType.Int, RaceID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SkillID", SqlDbType.Int, SkillID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ConditionalFeatID", SqlDbType.Int, ConditionalFeatID.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
コード例 #17
0
ファイル: Race.cs プロジェクト: dantastic-66/SWRPG_Sample
        /// <summary>
        /// Saves the force power descriptor.
        /// </summary>
        /// <returns>Race Object</returns>
        public Race SaveRace()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_Race";

                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceID", SqlDbType.Int, RaceID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceName", SqlDbType.VarChar, RaceName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceDescription", SqlDbType.VarChar, RaceDescription.ToString(), 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@OtherDescription", SqlDbType.VarChar, OtherDescription.ToString(), 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SizeID", SqlDbType.Int, SizeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Sex", SqlDbType.Char, Sex.ToString(), 1));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RageAbility", SqlDbType.Bit, RageAbility.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ShapeShiftAbility", SqlDbType.Bit, ShapeShiftAbility.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Primitive", SqlDbType.Bit, Primitive.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BonusSkill", SqlDbType.Bit, BonusSkill.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BonusFeat", SqlDbType.Bit, BonusFeat.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AverageHeight", SqlDbType.Decimal, AverageHeight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AverageWeight", SqlDbType.Decimal, AverageWeight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SpeedID", SqlDbType.Int, SpeedID.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
コード例 #18
0
ファイル: Race.cs プロジェクト: dantastic-66/SWRPG_Sample
        /// <summary>
        /// Deletes the extra class item.
        /// </summary>
        /// <returns>Boolean</returns>
        public bool DeleteRace()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Delete_Race";
                command.Parameters.Add(dbconn.GenerateParameterObj("@RaceID", SqlDbType.Int, RaceID.ToString(), 0));
                result = command.ExecuteReader();
            }
            catch
            {
                Exception e = new Exception();
                this._deleteOK = false;
                this._deletionMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this.DeleteOK);
        }
コード例 #19
0
 public string GetModelId()
 {
     return(RaceID.ToString());
 }
コード例 #20
0
ファイル: PlayerCharacter.cs プロジェクト: pasketi/Dicey
    public override void CreateCharacter(RaceID race)
    {
        _characterName = "Lost Vagabond";

        //Ability Scores
        int[] stats = { -1, -1, -1, -1, -1, -1 };
        int[] values = { 16, 14, 13, 12, 11, 10 };
        int   tempNum = 0;
        int   roundKill = 0;
        int   trained1 = -1, trained2 = -1, trained3 = -1;

        for (int i = 0; i < 6;)
        {
            tempNum = Random.Range(0, 6);
            if (System.Array.Exists(stats, stat => stat == tempNum) == false)
            {
                stats[i] = tempNum;
                i++;
            }

            roundKill++;
            if (roundKill >= 500)
            {
                Debug.LogError("BAD RNG, KILLED");
                break;
            }
        }

        for (int i = 0; i < 6; i++)
        {
            SetAbilityScore((AbilityID)stats[i], values[i]);
        }

        for (int i = 0; i < 3;)
        {
            switch (i)
            {
            case 0:
                trained1 = Random.Range(1, 17);
                i++;
                break;

            case 1:
                trained2 = Random.Range(1, 17);
                if (trained2 == trained1)
                {
                    trained2 = -1;
                }
                else
                {
                    i++;
                }
                break;

            case 2:
                trained3 = Random.Range(1, 17);
                if (trained3 == trained1 || trained3 == trained2)
                {
                    trained3 = -1;
                }
                else
                {
                    i++;
                }
                break;
            }
        }

        _trainedSkills[trained1] = true;
        _trainedSkills[trained2] = true;
        _trainedSkills[trained3] = true;
        _trainedSkills[0]        = true;

        base.CreateCharacter(race);
    }