Пример #1
0
					protected override void OnTick()
					{
						string DisplayName = "rag";
						if ( m_From.CheckTargetSkill( SkillName.Poisoning, m_Target, m_MinSkill, m_MaxSkill ) )
						{
							if ( m_Target is Food )
							{
								((Food)m_Target).Poison = m_Poison;
								DisplayName = "food item";
							}
							else if ( m_Target is BaseBeverage )
							{
								((BaseBeverage)m_Target).Poison = m_Poison;
								if(((BaseBeverage)m_Target).Quantity > 3)
								{
									m_From.SendMessage("You pour out some of the contents to make room for the poison.");
									((BaseBeverage)m_Target).Quantity = 3;
								}
								DisplayName = "beverage item";
							}
							else if ( m_Target is BaseWeapon)
							{
								((BaseWeapon)m_Target).Poison = m_Poison;
								((BaseWeapon)m_Target).PoisonCharges = 18 - (m_Poison.Level * 2);
								DisplayName = ((BaseWeapon)m_Target).ItemData.Name;
							}
							else if ( m_Target is Cloth)
							{
								// Only create the poison rag if the cloth is a single piece
								if (((Cloth)m_Target).Amount == 1)
								{	
									// delete the cloth
									((Cloth)m_Target).Delete();
								
									// Create the poison soaked rag (PoisonCloth type)
									PoisonCloth PCloth = new PoisonCloth();

									// Standard weapon poisoning parameters
									PCloth.Poison = m_Poison;
									PCloth.PoisonCharges = 18 - (m_Poison.Level * 2);
									// This is where to adjust the additional delay for time it 
									// takes to poison an arrow before it can be fired
									PCloth.Delay = 0;

									// Add the poison soaked rag to players backpack
									m_From.AddToBackpack(PCloth);
								}
							}
							switch (m_Poison.Level)
							{
								case 0:
									m_From.SendMessage("You apply the lesser poison to the " + DisplayName);
									break;
								case 1:
									m_From.SendMessage("You apply the poison to the " + DisplayName);
									break;
								case 2:
									m_From.SendMessage("You apply the greater poison to the " + DisplayName);
									break;
								case 3:
									m_From.SendMessage("You apply the deadly poison to the " + DisplayName);
									break;
								case 4:
									m_From.SendMessage("You apply the lethal poison to the " + DisplayName);
									break;
								default:
									m_From.SendMessage("You apply the poison to the " + DisplayName);
									break;
							}
								// Removed localized poisoning message and replaced with a 
								// more specific message based on the poison used
								//m_From.SendLocalizedMessage( 1010517 ); // You apply the poison

							Misc.Titles.AwardKarma( m_From, -20, true );
						}
						else // Failed
						{
							// 5% of chance of getting poisoned if failed
							if ( m_From.Skills[SkillName.Poisoning].Base < 80.0 && Utility.Random( 20 ) == 0 )
							{
								m_From.SendLocalizedMessage( 502148 ); // You make a grave mistake while applying the poison.
								m_From.ApplyPoison( m_From, m_Poison );
							}
							else
							{
								if ( m_Target is Food || m_Target is BaseBeverage)
								{
									m_From.SendLocalizedMessage( 1010518 ); // You fail to apply a sufficient dose of poison
								}
								else if ( m_Target is BaseWeapon )
								{
									BaseWeapon weapon = (BaseWeapon)m_Target;

									if ( weapon.Type == WeaponType.Slashing )
									{
										m_From.SendLocalizedMessage( 1010516 ); // You fail to apply a sufficient dose of poison on the blade
									}
									else
									{
										m_From.SendLocalizedMessage( 1010518 ); // You fail to apply a sufficient dose of poison
									}
								}
								else if ( m_Target is Cloth )
								{
									m_From.SendMessage( "You fail to apply a sufficient dose of poison to soak the rag." );
								}
							}
						}
                        //pla: set 10 second delay before next skill use
                        m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);
					}