コード例 #1
0
ファイル: Logger.cs プロジェクト: NeoTim/etch
 private void WriteToFile(Direction direction, Who msgOrigin, String msg)
 {
     if (writer == null)
     {
         return;
     }
     try
     {
         lock (writer)
         {
             writer.Write(DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.CreateSpecificCulture("en-US")));
             writer.Write(": ");
             writer.Write(ConvertDirToString(direction));
             writer.Write(": ");
             if (msgOrigin != null)
             {
                 writer.Write(msgOrigin.ToString());
                 writer.Write(": ");
             }
             writer.Write(msg);
             writer.WriteLine();
             writer.Flush();
         }
     }
     catch (Exception e)
     {
         writer.Close();
         throw e;
     }
 }
コード例 #2
0
 public override string ToString()
 {
     if (Type == MoveEffectType.ProtectStatStages)
     {
         return(string.Format("Protects against lowering of {0}'s stat stages", Who.ToString().ToLower()));
     }
     else if (Type == MoveEffectType.ResetStatStages)
     {
         return(string.Format("Resets stat stages of {0}", Who.ToString().ToLower()));
     }
     else
     {
         return(base.ToString());
     }
 }
コード例 #3
0
ファイル: StatEffect.cs プロジェクト: mblaine/PkMn
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0}% chance to ", Math.Round(((decimal)Chance) / 255m * 100m, 0));

            string whoStr = Who == Who.Self ? "own" : string.Format("{0}'s", Who.ToString().ToLower());

            string statStr = Stat == StatType.CritRatio ? "critical hit ratio" : Stat.ToString().ToLower();

            if (Constant != 0)
            {
                sb.AppendFormat("set {0} {1} to {2}", whoStr, statStr, Constant);
            }
            else if (Multiplier != 1m)
            {
                sb.AppendFormat("multiply {0} current {1} by {2}", whoStr, statStr, Multiplier);
            }
            else
            {
                sb.AppendFormat("{0} {1} {2} stat stage by {3}", Change > 0 ? "raise" : "lower", whoStr, statStr, Math.Abs(Change));
            }

            if (Temporary)
            {
                sb.Append(" for the current turn only");
            }

            if (Condition == "on-damaged")
            {
                sb.AppendFormat(" on damage received");
            }
            else if (!string.IsNullOrWhiteSpace(Condition))
            {
                sb.AppendFormat(" on {0}", Condition.Replace('-', ' '));
            }

            return(sb.ToString());
        }
コード例 #4
0
 public override string ToString()
 {
     return((Black ? "Black " : "White ") + Who.ToString() + (Index > 0 ? " " + Index : string.Empty));
 }
コード例 #5
0
ファイル: Message.cs プロジェクト: jphomi/JP-OpenWebNet
 public override string ToString()
 {
     return(string.Format("{0} - {1} - {2} - {3}", MessageType, Who.ToString(), What.ToString(), Where));
 }
コード例 #6
0
ファイル: StatusEffect.cs プロジェクト: mblaine/PkMn
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            if (Type == MoveEffectType.Status)
            {
                sb.AppendFormat("{0}% chance to ", Math.Round(((decimal)Chance) / 255m * 100m, 0));

                switch (Status)
                {
                case StatusCondition.BadlyPoisoned:
                    sb.AppendFormat("badly poison {0}", Who.ToString().ToLower());
                    break;

                case StatusCondition.Confusion:
                    sb.AppendFormat("confuse {0}", Who.ToString().ToLower());
                    break;

                case StatusCondition.Paralysis:
                    sb.AppendFormat("paralyze {0}", Who.ToString().ToLower());
                    break;

                case StatusCondition.Faint:
                case StatusCondition.Flinch:
                    sb.AppendFormat("cause {0} to {1}", Who.ToString().ToLower(), Status.ToString().ToLower());
                    break;

                case StatusCondition.Sleep:
                    sb.AppendFormat("{0} {1} to fall asleep", Force ? "force" : "cause", Who.ToString().ToLower());
                    break;

                default:
                    sb.AppendFormat("{0} {1}", Status.ToString().ToLower(), Who.ToString().ToLower());
                    break;
                }

                if (!string.IsNullOrWhiteSpace(Condition))
                {
                    sb.AppendFormat(" on {0}", Condition.Replace('-', ' '));
                }
            }
            else if (Type == MoveEffectType.ResetStatus)
            {
                switch (Status)
                {
                case StatusCondition.BadlyPoisoned:
                    sb.AppendFormat("Converts badly poisoned to just poisoned for {0}", Who.ToString().ToLower());
                    break;

                case StatusCondition.Confusion:
                    sb.AppendFormat("Removes confusion from {0}", Who.ToString().ToLower());
                    break;

                case StatusCondition.All:
                    sb.AppendFormat("Removes all status conditions from {0}", Who.ToString().ToLower());
                    break;

                default:
                    sb.AppendFormat("Removes status {0} from {1}", Status.ToString().ToLower(), Who.ToString().ToLower());
                    break;
                }
            }
            else
            {
                sb.Append(base.ToString());
            }

            return(sb.ToString());
        }