Exemplo n.º 1
0
 public TalkEventItem(int evtId, int l, Rectangle r, SceneQuestEvent e)
 {
     level  = l;
     pos    = r;
     evt    = e;
     config = ConfigData.GetSceneQuestConfig(evtId);
     if (config.TriggerDNAHard != null && config.TriggerDNAHard.Length > 0)
     {
         for (int i = 0; i < config.TriggerDNAHard.Length; i++)
         {
             if (UserProfile.InfoBasic.HasDna(DnaBook.GetDnaId(config.TriggerDNAHard[i])))
             {
                 hardness += DnaBook.GetDnaEffect(config.TriggerDNAHard[i]);
             }
         }
     }
     RunningState = TalkEventState.Running;
 }
Exemplo n.º 2
0
        private static bool IsQuestRateAvail(SceneQuestConfig questConfig)
        {
            if (questConfig.TriggerRate == 0)
            {
                return(true);
            }
            int rateBase = questConfig.TriggerRate;

            if (questConfig.TriggerDNARate != null && questConfig.TriggerDNARate.Length > 0)
            {
                for (int i = 0; i < questConfig.TriggerDNARate.Length; i++)
                {
                    var dnaName = questConfig.TriggerDNARate[i].Substring(0, 3);
                    if (UserProfile.InfoBasic.HasDna(DnaBook.GetDnaId(dnaName)))
                    {
                        rateBase *= (10 + DnaBook.GetDnaEffect(questConfig.TriggerDNARate[i])) / 10;
                    }
                }
            }
            return(MathTool.GetRandom(100) < rateBase);
        }