コード例 #1
0
 public TalentBox(Talent talent, Character character)
 {
     if (character == null)
         return;
     this.talent = talent;
     this.character = character;
     character.ExperienceChanged += CharacterOnExperienceChanged;
     character.PAChanged += CharacterOnExperienceChanged;
 }
コード例 #2
0
        public Character Load(String filename)
        {
            using (var sr = new StreamReader(filename))
            {
                SerializableCharacter character;
                character = JsonConvert.DeserializeObject<SerializableCharacter>(sr.ReadToEnd(),
                    _serializerSettings);

                Current = new Character(character);
                return Current;
            }
        }
コード例 #3
0
        public void CharacterSimpleConstructorTest()
        {
            string name = "TestName";
            var character = new Character(name, talentsManager);

            Assert.Equal(name, character.Name);
            Assert.Equal(null, character.Race);
            Assert.Equal(null, character.getClasse());
            Assert.Equal(0, character.ExperienceAvailable);
            Assert.Equal(20, character.ExperienceRemaining);
            Assert.Equal(-20, character.ExperienceUsed);
            /*Assert.Equal(20, character.Fatigue);
            Assert.Equal(20, character.Chi);
            Assert.Equal(20, character.Mana);
            Assert.Equal(20, character.Endurance);*/
        }
コード例 #4
0
        // [Fact]
        public void CharacterSerializedConstructorTest()
        {
            var serializedCharacter = new SerializableCharacter
            {
                Name = "Name",
                Experience = 50,
                AspectMalus = new List<Aspect> {Aspect.Arcane, Aspect.Feu},
                AspectBonus = new List<Aspect> {Aspect.Acier, Aspect.Eau},
            };

            var character = new Character(serializedCharacter, talentsManager,classManager: new MockClassManager());

            Assert.Equal("Name", character.Name);
            Assert.Equal(200, character.ExperienceAvailable);
            Assert.Equal(220, character.ExperienceRemaining);
            Assert.Equal(180, character.ExperienceUsed);
        }
コード例 #5
0
        public Cyrus0Test()
        {
            TalentsManager.Instance.Initialize();
            ClassManager.Instance.Initialize();
            RacesManager.Instance.Initialize();

            character = CharacterManager.Instance.Create("Cyrus");

            character.SetBonus(
                RacesManager.Instance.GetRace(1).AspectBonus,
                new[]
                {
                    character.GetTalent(3),
                    character.GetTalent(22)
                },
                RacesManager.Instance.GetRace(1)
                );
        }
コード例 #6
0
 public AspectBonusForm()
 {
     if (CharacterManager.Current == null)
         return;
     character = CharacterManager.Current;
     if (character.haveBonus())
     {
         Bonus1 = character.getBonusAspect()[0];
         Bonus2 = character.getBonusAspect()[1];
         Malus1 = character.getMalusAspect()[0];
         Malus2 = character.getMalusAspect()[1];
     }
     else
     {
         Bonus1 = Aspect.None;
         Bonus2 = Aspect.None;
         Malus1 = Aspect.None;
         Malus2 = Aspect.None;
     }
 }
コード例 #7
0
        public static string ExportCharacter(Character character)
        {
            const string separator = "-------------------------------------------";
            var fiche = new List<String>
            {
                String.Format("Nom: {0}", character.Name),
                String.Format("Race: {0}", character.Race.Name),
                String.Format("Classe: {0}", character.getClasse()),
                String.Format("Niveau: {0}", character.GetLevel())
            };
            fiche.Add(separator);
            fiche.AddRange(
                new[] {Aspect.Eau, Aspect.Feu, Aspect.Terre, Aspect.Vent, Aspect.Acier, Aspect.Arcane, Aspect.Equilibre}
                    .Select(item => String.Format("{0} : {1}", item, character.GetAspectValue(item)))
                    );

            fiche.Add(separator);
            fiche.Add(String.Format("PS: {0}", character.Ps));
            fiche.Add(String.Format("PE Indemne: {0}", character.Endurance + 5 * character.GetTalent("Endurance").Level));
            fiche.Add(String.Format("PE: {0}", character.Endurance));
            fiche.Add(String.Format("PE Agonisant: {0}", character.Endurance + 7 * character.GetTalent("Volonté").Level));
            fiche.Add(String.Format("PF: {0}", character.Fatigue));
            fiche.Add(String.Format("PC: {0}", character.Chi));
            fiche.Add(String.Format("PM: {0}", character.Mana));
            fiche.Add(String.Format("PK: {0}", character.Karma()));

            fiche.Add(separator);

            fiche.AddRange(from talent in character.Talents
                           where talent.Level > 0
                           select String.Format("{0}: {1}", talent.Name, talent.Level)
                           );

            fiche.Add(separator);
            Classe classe = character.getClasse();
            if (classe != null)
            {
                fiche.Add("Récupération:");
                fiche.Add(String.Format("PE: {0}", classe.RPE));
                fiche.Add(String.Format("PF: {0}", classe.RPF));
                fiche.Add(String.Format("PC: {0}", classe.RPC));
                fiche.Add(String.Format("PM: {0}", classe.RPM));

                fiche.Add(separator);
            }
            fiche.Add("Sauvegardes:");
            fiche.Add(String.Format("Reflexe: {0}", character.Reflex));
            fiche.Add(String.Format("Robustesse: {0}", character.Robustesse));
            fiche.Add(String.Format("Volonté: {0}", character.Willpower));

            fiche.Add(separator);

            fiche.Add("Stats secondaires:");
            fiche.Add(String.Format("Pénalité de poids: {0}", character.penPoid));
            fiche.Add(String.Format("Déplacement: {0}", 3 + character.GetAspectValue(Aspect.Vent)/3 - character.penPoid));
            fiche.Add(String.Format("Initiative: {0}", character.GetAspectValue(Aspect.Vent) - character.penPoid));
            fiche.Add(String.Format("Réunion de Mana: {0}", 6 - character.penPoid));
            fiche.Add(String.Format("Impulsion de Mana: {0}", 5 + character.GetAspectValue(Aspect.Vent)));

            return string.Join(Environment.NewLine, fiche);
        }
コード例 #8
0
 private void character_PAChanged(Character caller)
 {
     OnPropertyChanged(null);
 }
コード例 #9
0
 private void OnClassChanged(Character caller)
 {
     CharacterEventHandler handler = ClassChanged;
     if (handler != null) handler(caller);
 }
コード例 #10
0
 private void CharacterManager_OnCharacterChanged(Character caller)
 {
     character = caller;
     OnPropertyChanged(null);
 }
コード例 #11
0
        public CyrusTest()
        {
            TalentsManager.Instance.Initialize();
            ClassManager.Instance.Initialize();
            RacesManager.Instance.Initialize();
            Bijouxmanager.Instance.Initialize();

            character = new Character(source);
            CharacterManager.Current = character;

            character.SetBonus(
                RacesManager.Instance.GetRace(1).AspectBonus,
                new[]
                {
                    character.GetTalent(3),
                    character.GetTalent(22)
                },
                RacesManager.Instance.GetRace(1)
                );
            character.Inventory.Ring1.Material = Bijouxmanager.Instance.getFromName("Spinelle");
            character.Inventory.Ring1.Quality = 3;
        }
コード例 #12
0
 public Character Create(String name)
 {
     var character = new Character(name, _talents);
     Current = character;
     return character;
 }
コード例 #13
0
 private void CharacterManager_OnCharacterChanged(Character caller)
 {
     character = caller;
     mainStatsAspects = new MainStatsAspects(character);
     character.PAChanged += caller1 => OnPropertyChanged(null);
     character.Inventory.TrinketChanged += () => OnPropertyChanged(null);
     character.ClassChanged += (var) => OnPropertyChanged(null);
     OnPropertyChanged(null);
 }
コード例 #14
0
 private void CharacterOnExperienceChanged(Character caller)
 {
     OnPropertyChanged(null);
 }
コード例 #15
0
 private void CharacterManager_OnCharacterChanged(Character caller)
 {
     character = caller;
     character.ExperienceChanged += CharacterOnXpChanged;
     character.PAChanged += CharacterOnXpChanged;
     OnPropertyChanged(null);
 }
コード例 #16
0
 private void CharacterOnXpChanged(Character caller)
 {
     OnPropertyChanged(() => Race);
     OnPropertyChanged(() => ExperienceAvailable);
     OnPropertyChanged(() => ExperienceRemaining);
     OnPropertyChanged(() => AddExperienceCommand);
     OnPropertyChanged(() => RemoveExperienceCommand);
     OnPropertyChanged(() => Level);
 }
コード例 #17
0
 public void Save(Character character, String filename)
 {
     using (var sw = new StreamWriter(filename, false))
     {
         String json = JsonConvert.SerializeObject(character.GetSerializableCharacter(), _serializerSettings);
         sw.Write(json);
     }
 }
コード例 #18
0
 public TalentGroupBox(Character character)
     : this()
 {
     this.character = character;
 }
コード例 #19
0
 private static void OnCharacterChanged(Character caller)
 {
     Character.CharacterEventHandler handler = CharacterChanged;
     if (handler != null) handler(caller);
 }
コード例 #20
0
 private void OnCharacterChanged(Character caller)
 {
     if (caller != null)
     {
         armorSet = caller.Inventory.Armor;
         talent = caller.GetTalent("Resistance");
         talent.LevelChanged += OnTalentChanged;
     }
     else
     {
         armorSet = new ArmorSet();
         talent = null;
     }
     OnPropertyChanged(null);
 }
コード例 #21
0
 private void CharacterManager_OnCharacterChanged(Character caller)
 {
     character = caller;
     character.GetTalent("Apprentissage").LevelChanged += (sender, args) => OnPropertyChanged(() => Competences);
     character.GetTalent("Maitrise").LevelChanged += (sender, args) => OnPropertyChanged(() => Competences);
     SelectedClasse = character.getClasse();
     OnPropertyChanged(null);
 }
コード例 #22
0
 public SecondaryStatsMagic(Character character = null)
 {
     this.character = character;
     if (character != null)
         character.PAChanged += character_PAChanged;
 }
コード例 #23
0
 private void CharacterManager_OnCharacterChanged(Character caller)
 {
     character = caller;
     if (character != null)
         character.PAChanged += CharacterOnPAChanged;
     OnPropertyChanged(null);
 }
コード例 #24
0
 private void OnCharacterChanged(Character caller)
 {
     inventory = caller.Inventory;
     inventory.TrinketChanged += () => OnPropertyChanged(null);
     OnPropertyChanged(null);
 }
コード例 #25
0
 public MainStatsAspects(Character character)
 {
     this.character = character;
     character.PAChanged += caller => OnPropertyChanged(null);
 }