public NewWord(string name, Nature nature, double score) { Name = name; Nature = nature; Score = score; AllFreq = 1; }
public DummyNode(int inputCount, int outputCount, string legacyName, XmlElement originalElement, string legacyAssembly, Nature nodeNature) { InputCount = inputCount; OutputCount = outputCount; LegacyNodeName = legacyName; NickName = legacyName; OriginalNodeContent = originalElement; LegacyAssembly = legacyAssembly; NodeNature = nodeNature; Description = GetDescription(); ShouldDisplayPreviewCore = false; UpdatePorts(); // Take the position from the old node (because a dummy node // should always be created at the location of the old node). var helper = new XmlElementHelper(originalElement); X = helper.ReadDouble("x", 0.0); Y = helper.ReadDouble("y", 0.0); //Take the GUID from the old node (dummy nodes should have their //GUID's. This will allow the Groups to work as expected. MAGN-7568) GUID = helper.ReadGuid("guid", this.GUID); }
/// <summary> /// 更新发现权重,并且更新词性 /// </summary> /// <param name="nature"></param> /// <param name="freq"></param> public void Update(Nature nature, int freq) { // TODO Auto-generated method stub Score += Score*freq; AllFreq += freq; if (Nature.NW != nature) { Nature = nature; } }
private Character(string name, IPosition startPosition, Nature nature, int might, int magic) { this.Name = name; this.StartPosition = startPosition; this.Nature = nature; this.Items = Bag<IItem>.Create(); this.PureMight = might; this.PureMagic = magic; this._startMight = might; this._startMagic = magic; this.Life = GameConstants.LifeOnStart; this.Gold = GameConstants.GoldOnStart; }
public Pokemon(BaseStats bs, int l = 1, Move[] ms = null, string n = null) { baseStats = bs; personality = (uint)((PRNG.Instance.Next() << 16) + PRNG.Instance.Next()); nature = (Nature)(personality % 25); happiness = baseStats.baseHappiness; if (baseStats.abilities.Length == 1) ability = baseStats.abilities[0]; else ability = baseStats.abilities[personality % 2]; int iv1 = PRNG.Instance.Next(); int iv2 = PRNG.Instance.Next(); hpIV = (byte)(iv1 & 0x1F); attackIV = (byte)(iv1 & 0x3E0); defenseIV = (byte)(iv1 & 0x7C00); specialDefenseIV = (byte)(iv2 & 0x1F); specialAttackIV = (byte)(iv2 & 0x3E0); speedIV = (byte)(iv2 & 0x7C00); nickname = n; shiny = ((OTid ^ OTsecretid) ^ ((personality >> 16) ^ (personality & 65535))) < 8 ? true : false; for (int i = 0; i < l; i++) LevelUp(); hp = maxHP; metLocation = Player.Instance.currentMap; metLevel = Level; if (ms == null) { int i = 0; foreach (LearnableMove m in baseStats.learnset) { if (Level >= m.level) { moveSet[i] = m.move; PP[i] = m.move.basePP; i = (i == 3) ? 0 : i + 1; } else break; } } else moveSet = ms; }
public Notification(string message, Nature nature) { this.Message = message; this.Nature = nature; }
public static FieldAbility GetSynchronize(Nature syncNature) => new FieldAbility(syncNature: syncNature);
/// <summary> /// 当前属性是否包含指定词频 /// </summary> /// <param name="nat"></param> /// <returns></returns> public bool HashNature(Nature nat) => GetFreq(nat) > 0;
public string ToJPN(Nature nature) => natures[(int)nature];
public Action(int amount, Nature nature, Requirements reqs) { Amount = amount; Nature = nature; Reqs = reqs; }
public Attribute(Nature nat, int freq) { natures = new[] { nat }; freqs = new[] { freq }; totalFreq = freq; }
public ActionResult Create( [Bind(Include = "Id,Notation,RemoteDb,RemoteId,Description,Matter,MatterId")] CommonSequence commonSequence, bool localFile, Language?language, bool?original, Translator?translator, bool?partial, int?precision) { return(CreateTask(() => { var db = new LibiadaWebEntities(); try { if (!ModelState.IsValid) { throw new Exception("Model state is invalid"); } Stream sequenceStream; Nature nature = commonSequence.Notation.GetNature(); if (nature == Nature.Genetic && !localFile) { sequenceStream = NcbiHelper.GetFastaFileStream(commonSequence.RemoteId); } else { sequenceStream = FileHelper.GetFileStream(Request.Files[0]); } switch (nature) { case Nature.Genetic: ISequence bioSequence = NcbiHelper.GetFastaSequence(sequenceStream); var dnaSequenceRepository = new GeneticSequenceRepository(db); dnaSequenceRepository.Create(commonSequence, bioSequence, partial ?? false); break; case Nature.Music: var musicSequenceRepository = new MusicSequenceRepository(db); musicSequenceRepository.Create(commonSequence, sequenceStream); break; case Nature.Literature: var literatureSequenceRepository = new LiteratureSequenceRepository(db); literatureSequenceRepository.Create(commonSequence, sequenceStream, language ?? Language.Russian, original ?? true, translator ?? Translator.NoneOrManual); break; case Nature.MeasurementData: var dataSequenceRepository = new DataSequenceRepository(db); dataSequenceRepository.Create(commonSequence, sequenceStream, precision ?? 0); break; case Nature.Image: var matterRepository = new MatterRepository(db); int fileSize = Request.Files[0].ContentLength; var file = new byte[fileSize]; Request.Files[0].InputStream.Read(file, 0, fileSize); var matter = new Matter { Nature = Nature.Image, SequenceType = commonSequence.Matter.SequenceType, Name = commonSequence.Matter.Name, Source = file, Group = commonSequence.Matter.Group }; matterRepository.SaveToDatabase(matter); break; default: throw new InvalidEnumArgumentException(nameof(nature), (int)nature, typeof(Nature)); } string multisequenceName = db.Multisequence.SingleOrDefault(ms => ms.Id == commonSequence.Matter.MultisequenceId).Name; var result = new ImportResult(commonSequence, language, original, translator, partial, precision, multisequenceName); return new Dictionary <string, string> { { "data", JsonConvert.SerializeObject(result) } }; } catch (Exception) { long matterId = commonSequence.MatterId; if (matterId != 0) { List <Matter> orphanMatter = db.Matter .Include(m => m.Sequence) .Where(m => m.Id == matterId && m.Sequence.Count == 0) .ToList(); if (orphanMatter.Count > 0) { db.Matter.Remove(orphanMatter[0]); db.SaveChanges(); } } throw; } finally { Dispose(true); } })); }
public Action(int amount, Nature nature) { Amount = amount; Nature = nature; }
private void Awake() { Instance = this; }
private void LoadData(Nature c) { NatureImage.Source = new BitmapImage(new Uri(c.Picture)); NatureName.Text = c.Name; NatureEnName.Text = c.EnName; // 富含/偶尔/稀有 var thickness = new Thickness(5, 0, 0, 0); if (c.Abundant == null || c.Abundant.Count == 0) { NaturalAbundantTextBlock.Visibility = Visibility.Collapsed; NaturalAbundantWrapPanel.Visibility = Visibility.Collapsed; } else { foreach (var picPath in c.Abundant) { var picButton = new PicButton { HorizontalAlignment = HorizontalAlignment.Left, Margin = thickness, Source = StringProcess.GetGameResourcePath(picPath) }; NaturalAbundantWrapPanel.Children.Add(picButton); } } if (c.Occasional == null || c.Occasional.Count == 0) { NaturalOccasionalTextBlock.Visibility = Visibility.Collapsed; NaturalOccasionalWrapPanel.Visibility = Visibility.Collapsed; } else { foreach (var picPath in c.Occasional) { var picButton = new PicButton { HorizontalAlignment = HorizontalAlignment.Left, Margin = thickness, Source = StringProcess.GetGameResourcePath(picPath) }; NaturalOccasionalWrapPanel.Children.Add(picButton); } } if (c.Rare == null || c.Rare.Count == 0) { NaturalRareTextBlock.Visibility = Visibility.Collapsed; NaturalRareWrapPanel.Visibility = Visibility.Collapsed; } else { foreach (var picPath in c.Rare) { var picButton = new PicButton { HorizontalAlignment = HorizontalAlignment.Left, Margin = thickness, Source = StringProcess.GetGameResourcePath(picPath) }; NaturalRareWrapPanel.Children.Add(picButton); } } // 介绍 NatureIntroduction.Text = c.Introduction; }
public IMonster BuildMonster() { return(Monsters[Nature.BuildRandomNumber(0, Monsters.Length)]); }
public NewWord(string name, Nature nature) { Name = name; Nature = nature; AllFreq = 1; }
public static bool IsFixed(this Nature value) => value is >= 0 and < Nature.Random;
public DummyNode(int inputCount, int outputCount, string legacyName, XmlElement originalElement, string legacyAssembly, Nature nodeNature) { InputCount = inputCount; OutputCount = outputCount; LegacyNodeName = legacyName; OriginalNodeContent = originalElement; LegacyAssembly = legacyAssembly; NodeNature = nodeNature; Description = GetDescription(); ShouldDisplayPreviewCore = false; UpdatePorts(); }
public DummyNode(int inputCount, int outputCount, string legacyName, XmlElement originalElement, string legacyAssembly, Nature nodeNature) { InputCount = inputCount; OutputCount = outputCount; LegacyNodeName = legacyName; NickName = legacyName; OriginalNodeContent = originalElement; LegacyAssembly = legacyAssembly; NodeNature = nodeNature; Description = GetDescription(); ShouldDisplayPreviewCore = false; UpdatePorts(); // Take the position from the old node (because a dummy node // should always be created at the location of the old node). var helper = new XmlElementHelper(originalElement); X = helper.ReadDouble("x", 0.0); Y = helper.ReadDouble("y", 0.0); }
/// <summary> /// 使用单个词性,默认词频1000,构造对象 /// </summary> /// <param name="nat"></param> public Attribute(Nature nat) : this(nat, 1000) { }
public Term(string word, Nature nature) { this.word = word; this.nature = nature; }
public string Translate(Nature nature) => natures[(int)nature];
public string ext1; // 扩展字段,用于存储额外信息,具体需要根据NatCom词性来确定存储的什么样的信息 public ComTerm(string word, Nature nature) : base(word, nature) { }
public void SetPlayer() { player = _transform.root.GetComponentInChildren< Player >(); if(player) { SetTeamColor(); GameObject.Find("CanvasHUD").GetComponentInChildren<CanvasHUDManager>().miniMap.AddBlip(mapIcon, player.teamColor, ObjectId, this); } else { nature = _transform.root.GetComponentInChildren< Nature >(); } }
internal static bool CheckNature(this uint pid, Nature fixedNature) => fixedNature == Nature.other || (pid % 25) == (uint)fixedNature;
private FieldAbility(Nature syncNature = Nature.other, Gender cuteCharmGender = Gender.Genderless, PokeType attractingType = PokeType.Non) { this.syncNature = syncNature; this.cuteCharmGender = cuteCharmGender; this.attractingType = attractingType; }
void IEditableCharacter.ChangeNature(Nature newCharacterNature) { this.Nature = newCharacterNature; }
/// <summary> /// Initializes a new instance of the <see cref="NatureAttribute"/> class. /// </summary> /// <param name="value"> /// The Nature value. /// </param> public NatureAttribute(Nature value) { Value = value; }
public static ICharacter Create(string name, IPosition startPosition, Nature nature, int might, int magic) { return new Character(name, startPosition, nature, might, magic); }
public ActionResult Index( long[] matterIds, short[] characteristicLinkIds, int length, int step, bool delta, bool fourier, bool growingWindow, bool autocorrelation, Notation notation, Language?language, Translator?translator, PauseTreatment?pauseTreatment, bool?sequentialTransfer) { return(CreateTask(() => { var characteristicNames = new string[characteristicLinkIds.Length]; var partNames = new List <string> [matterIds.Length]; var starts = new List <int> [matterIds.Length]; var lengthes = new List <int> [matterIds.Length]; var chains = new Chain[matterIds.Length]; var mattersCharacteristics = new object[matterIds.Length]; var calculators = new IFullCalculator[characteristicLinkIds.Length]; var links = new Link[characteristicLinkIds.Length]; matterIds = matterIds.OrderBy(m => m).ToArray(); Dictionary <long, Matter> matters = db.Matter.Where(m => matterIds.Contains(m.Id)).ToDictionary(m => m.Id); for (int k = 0; k < matterIds.Length; k++) { long matterId = matterIds[k]; Nature nature = db.Matter.Single(m => m.Id == matterId).Nature; long sequenceId; switch (nature) { case Nature.Literature: sequenceId = db.LiteratureSequence.Single(l => l.MatterId == matterId && l.Notation == notation && l.Language == language && l.Translator == translator).Id; break; case Nature.Music: sequenceId = db.MusicSequence.Single(m => m.MatterId == matterId && m.Notation == notation && m.PauseTreatment == pauseTreatment && m.SequentialTransfer == sequentialTransfer).Id; break; default: sequenceId = db.CommonSequence.Single(c => c.MatterId == matterId && c.Notation == notation).Id; break; } chains[k] = commonSequenceRepository.GetLibiadaChain(sequenceId); } for (var i = 0; i < characteristicLinkIds.Length; i++) { int characteristicLinkId = characteristicLinkIds[i]; FullCharacteristic characteristic = characteristicTypeLinkRepository.GetCharacteristic(characteristicLinkId); calculators[i] = FullCalculatorsFactory.CreateCalculator(characteristic); links[i] = characteristicTypeLinkRepository.GetLinkForCharacteristic(characteristicLinkId); } for (int i = 0; i < chains.Length; i++) { CutRule cutRule = growingWindow ? (CutRule) new CutRuleWithFixedStart(chains[i].Length, step) : new SimpleCutRule(chains[i].Length, step, length); CutRuleIterator iterator = cutRule.GetIterator(); var fragments = new List <Chain>(); partNames[i] = new List <string>(); starts[i] = new List <int>(); lengthes[i] = new List <int>(); while (iterator.Next()) { int start = iterator.GetStartPosition(); int end = iterator.GetEndPosition(); var fragment = new List <IBaseObject>(); for (int k = 0; start + k < end; k++) { fragment.Add(chains[i][start + k]); } fragments.Add(new Chain(fragment)); partNames[i].Add(fragment.ToString()); starts[i].Add(iterator.GetStartPosition()); lengthes[i].Add(fragment.Count); } var fragmentsData = new FragmentData[fragments.Count]; for (int k = 0; k < fragments.Count; k++) { var characteristics = new double[calculators.Length]; for (int j = 0; j < calculators.Length; j++) { characteristics[j] = calculators[j].Calculate(fragments[k], links[j]); } fragmentsData[k] = new FragmentData(characteristics, fragments[k].ToString(), starts[i][k], fragments[k].Length); } double[][] differenceData = null; double[][] fourierData = null; double[][] autocorrelationData = null; if (delta) { differenceData = CalculateDifference(fragmentsData.Select(f => f.Characteristics).ToArray()); } if (fourier) { fourierData = FastFourierTransform.CalculateFastFourierTransform(fragmentsData.Select(f => f.Characteristics).ToArray()); } if (autocorrelation) { autocorrelationData = AutoCorrelation.CalculateAutocorrelation(fragmentsData.Select(f => f.Characteristics).ToArray()); } mattersCharacteristics[i] = new LocalCharacteristicsData { matterName = matters[matterIds[i]].Name, fragmentsData = fragmentsData, differenceData = differenceData, fourierData = fourierData, autocorrelationData = autocorrelationData }; } for (int l = 0; l < characteristicLinkIds.Length; l++) { characteristicNames[l] = characteristicTypeLinkRepository.GetCharacteristicName(characteristicLinkIds[l]); } var characteristicsList = new SelectListItem[characteristicLinkIds.Length]; for (int k = 0; k < characteristicLinkIds.Length; k++) { characteristicNames[k] = characteristicTypeLinkRepository.GetCharacteristicName(characteristicLinkIds[k], notation); characteristicsList[k] = new SelectListItem { Value = k.ToString(), Text = characteristicNames[k], Selected = false }; } var result = new Dictionary <string, object> { { "characteristics", mattersCharacteristics }, { "notationName", notation.GetDisplayValue() }, { "starts", starts }, { "partNames", partNames }, { "lengthes", lengthes }, { "characteristicNames", characteristicNames }, { "matterIds", matterIds }, { "characteristicsList", characteristicsList }, { "aligners", EnumHelper.GetSelectList(typeof(Aligner)) }, { "distanceCalculators", EnumHelper.GetSelectList(typeof(DistanceCalculator)) }, { "aggregators", EnumHelper.GetSelectList(typeof(Aggregator)) } }; return new Dictionary <string, object> { { "data", JsonConvert.SerializeObject(result) } }; })); }
public static PokemonEngine.Model.Unique.IPokemon Construct(string uid, Gender gender, Nature nature, Ability ability, PokemonEngine.Model.Unique.IVSet ivs, PokemonEngine.Model.Unique.EVSet evs, PokemonEngine.Model.Unique.MoveSet <PokemonEngine.Model.Unique.IMove> moves, int friendship, int level) { return(new PokemonEngine.Model.Unique.Pokemon(Instance, uid, gender, nature, ability, ivs, evs, moves, friendship, level)); }
/** * 词性是否以该前缀开头<br> * 词性根据开头的几个字母可以判断大的类别 * @param prefix 前缀 * @return 是否以该前缀开头 */ public static bool startsWith(this Nature nature, String prefix) { return(nature.ToString().StartsWith(prefix)); }
public Pokemon(Model.Pokemon basePokemon, Gender gender, Nature nature, Ability ability, IVSet ivs, EVSet evs, MoveSet <IMove> moves, int level) : this(basePokemon, Guid.NewGuid().ToString(), gender, nature, ability, ivs, evs, moves, basePokemon.Friendship, level) { }
void Awake() { nature = GetComponentInParent<Nature>(); }
float NatureBoost(Nature nature, string statName) { statName = getId(statName); return((nature.plus == statName) ? 1.1f : (nature.minus == statName) ? 0.9f : 1f); }
/** * 词性是否以该前缀开头<br> * 词性根据开头的几个字母可以判断大的类别 * @param prefix 前缀 * @return 是否以该前缀开头 */ public static bool startsWith(this Nature nature, char prefix) { return(nature.ToString()[0] == prefix); }
public Individual GetIndividual(uint lv, uint[] ivs, uint ec, uint pid, Nature nature, uint abilityIndex, Gender gender) => new Individual(this, lv, ec, pid, nature, gender, abilityIndex, ivs);
/** * 词性的首字母<br> * 词性根据开头的几个字母可以判断大的类别 * @return */ public static char firstChar(this Nature nature) { return(nature.ToString()[0]); }
private FixedNatureGenerator(Nature fixedNature) => this.fixedNature = fixedNature;