JNR
rpgPotion.cpp
1 /*
2 
3 Jump'n'Run Engine
4 http://www.atanaslaskov.com/jnr/
5 
6 BSD LICENSE
7 Copyright (c) 2007-2013, Atanas Laskov
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer.
14 2. Redistributions in binary form must reproduce the above copyright notice,
15 this list of conditions and the following disclaimer in the documentation
16 and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL ATANAS LASKOV BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 */
29 
30 //
31 // FILE: rpgPotion.cpp
32 //
33 // The properties of a potion-like effect, associated with an attack or potion
34 //
35 // Copyright (C) 2007-2013 Atanas Laskov, <latanas@gmail.com>
36 //
37 #include "stdafx.h"
38 #include "RPG.h"
39 #include "Core-Level-JR.h"
40 
41 void rpgPotion::load(class laPropertyList* pElement)
42 {
43  rpgItem::load(pElement);
44 
45  color = pElement->getParent()->getColor("color");
46  dDuration = dDurationReminder = pElement->getDouble("duration");
47 
48  // Load properties
49  //
50  dMod_Speed = pElement->getDouble("mod-Speed");
51  dMod_JPower = pElement->getDouble("mod-JPower");
52  dMod_SPower = pElement->getDouble("mod-SPower");
53 
54  dMod_AP = pElement->getDouble("mod-AP");
55  dMod_DP = pElement->getDouble("mod-DP");
56 
57  dMod_XP = pElement->getDouble("mod-XP");
58 
59  // Load special props
60  //
61  bShrink = pElement->getBool("mod-shrink");
62  bLevitate = pElement->getBool("mod-levitate");
63  bGrasshopper = pElement->getBool("mod-grashopper");
64  bDrunk = pElement->getBool("mod-drunk");
65 
66  // Remember this TS element and use it to
67  // draw potion icons
68  //
69  //uiPotionDescriptor::_pPotionElement = pElement;
70 }
71 
72 
73 /*void rpgPotion::load(class laFileParser *fp)
74 {
75  ASSERT(M_FALSE, "Not implemented.");
76 
77  // Load properties
78  //
79  fp->readDouble(&dDuration, M_FALSE);
80 
81  fp->readDouble(&dMod_AP);
82  fp->readDouble(&dMod_DP);
83  fp->readDouble(&dMod_XP);
84  fp->readDouble(&dSpeed_Modifier);
85 
86  fp->readBool(&bShrink);
87  fp->readBool(&bLevitate);
88  fp->readBool(&bGrasshopper);
89  fp->readBool(&bDrunk);
90  fp->readBool(&bColorize);
91 
92  // Count effects
93  //
94  nEffectCount = 0;
95 
96  if((dMod_AP>1.01) || (dMod_AP<0.99))
97  nEffectCount++;
98 
99  if((dMod_DP>1.01) || (dMod_DP<0.99))
100  nEffectCount++;
101 
102  if((dMod_XP>1.01) || (dMod_XP<0.99))
103  nEffectCount++;
104 
105  if((dSpeed_Modifier>1.01) || (dSpeed_Modifier<0.99))
106  nEffectCount++;
107 
108  if(bLevitate) nEffectCount++;
109  if(bLevitate) nEffectCount++;
110  if(bGrasshopper) nEffectCount++;
111  if(bDrunk) nEffectCount++;
112  if(bColorize) nEffectCount++;
113 }*/
114 
115 void rpgPotion::createIcon()
116 {
117  pIcon = new uiIcon3D( new uiPotionDescriptor( this ) );
118 }
GUI icon object that can siplay 3D models as icons.
Definition: uiIcon3D.h:52