| 1 | package Games::Framework::RCP::Database::Result::Combatant; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | our $VERSION = '0.22'; | |
| 7 | |||
| 8 | 3 | ▶ | use base qw/DBIx::Class/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | __PACKAGE__->load_components(qw/UTF8Columns Core/); | |
| 11 | 3 | __PACKAGE__->table('combatants'); | |
| 12 | 3 | __PACKAGE__->add_columns( | |
| 13 | id_combatant => { | ||
| 14 | data_type => 'integer', | ||
| 15 | is_nullable => 0, | ||
| 16 | is_auto_increment => 1, | ||
| 17 | comments => 'ID of the combatant.', | ||
| 18 | extra => {unsigned => 1}, | ||
| 19 | }, | ||
| 20 | join_time => { | ||
| 21 | data_type => 'datetime', | ||
| 22 | is_nullable => 0, | ||
| 23 | default_value => 'now()', | ||
| 24 | comments => 'Time the combatant joined.', | ||
| 25 | }, | ||
| 26 | fkey_character => { | ||
| 27 | data_type => 'integer', | ||
| 28 | is_nullable => 0, | ||
| 29 | comments => 'ID of the character.', | ||
| 30 | extra => {unsigned => 1}, | ||
| 31 | }, | ||
| 32 | fkey_class => { | ||
| 33 | data_type => 'integer', | ||
| 34 | is_nullable => 0, | ||
| 35 | comments => 'ID of the primary class.', | ||
| 36 | extra => {unsigned => 1}, | ||
| 37 | }, | ||
| 38 | starting_job => { | ||
| 39 | data_type => 'integer', | ||
| 40 | is_nullable => 0, | ||
| 41 | comments => 'ID of the class the combatant joined as.', | ||
| 42 | extra => {unsigned => 1}, | ||
| 43 | }, | ||
| 44 | secondary => { | ||
| 45 | data_type => 'varchar', | ||
| 46 | size => 32, | ||
| 47 | is_nullable => 1, | ||
| 48 | comments => 'The secondary class a fighter may bring.', | ||
| 49 | }, | ||
| 50 | support => { | ||
| 51 | data_type => 'varchar', | ||
| 52 | size => 32, | ||
| 53 | is_nullable => 1, | ||
| 54 | comments => 'A support skill a fighter may bring.', | ||
| 55 | }, | ||
| 56 | reaction => { | ||
| 57 | data_type => 'varchar', | ||
| 58 | size => 32, | ||
| 59 | is_nullable => 1, | ||
| 60 | comments => 'A reaction skill a fighter may bring.', | ||
| 61 | }, | ||
| 62 | display_name => { | ||
| 63 | data_type => 'varchar', | ||
| 64 | size => 32, | ||
| 65 | is_nullable => 0, | ||
| 66 | comments => 'The current name of the fighter. Can be renamed mid-fight.', | ||
| 67 | }, | ||
| 68 | hp => { | ||
| 69 | data_type => 'numeric', | ||
| 70 | is_nullable => 0, | ||
| 71 | size => [12,4], | ||
| 72 | comments => 'HP', | ||
| 73 | }, | ||
| 74 | mp => { | ||
| 75 | data_type => 'numeric', | ||
| 76 | is_nullable => 0, | ||
| 77 | size => [12,4], | ||
| 78 | comments => 'MP', | ||
| 79 | }, | ||
| 80 | pp => { | ||
| 81 | data_type => 'numeric', | ||
| 82 | is_nullable => 0, | ||
| 83 | size => [12,4], | ||
| 84 | comments => 'PP', | ||
| 85 | }, | ||
| 86 | max_hp => { | ||
| 87 | data_type => 'numeric', | ||
| 88 | is_nullable => 0, | ||
| 89 | size => [12,4], | ||
| 90 | comments => 'Max HP.', | ||
| 91 | }, | ||
| 92 | max_mp => { | ||
| 93 | data_type => 'numeric', | ||
| 94 | is_nullable => 0, | ||
| 95 | size => [12,4], | ||
| 96 | comments => 'Max MP.', | ||
| 97 | }, | ||
| 98 | max_pp => { | ||
| 99 | data_type => 'numeric', | ||
| 100 | is_nullable => 0, | ||
| 101 | size => [12,4], | ||
| 102 | comments => 'Max PP', | ||
| 103 | }, | ||
| 104 | ct => { | ||
| 105 | data_type => 'numeric', | ||
| 106 | is_nullable => 0, | ||
| 107 | size => [12,4], | ||
| 108 | comments => 'Charge Time. Unit of measurement to see who moves.', | ||
| 109 | }, | ||
| 110 | spd => { | ||
| 111 | data_type => 'numeric', | ||
| 112 | is_nullable => 0, | ||
| 113 | size => [12,4], | ||
| 114 | comments => 'Speed', | ||
| 115 | }, | ||
| 116 | patk => { | ||
| 117 | data_type => 'numeric', | ||
| 118 | is_nullable => 0, | ||
| 119 | size => [12,4], | ||
| 120 | comments => 'Physical Attack', | ||
| 121 | }, | ||
| 122 | matk => { | ||
| 123 | data_type => 'numeric', | ||
| 124 | is_nullable => 0, | ||
| 125 | size => [12,4], | ||
| 126 | comments => 'Magical Attack', | ||
| 127 | }, | ||
| 128 | pdef => { | ||
| 129 | data_type => 'numeric', | ||
| 130 | is_nullable => 0, | ||
| 131 | size => [12,4], | ||
| 132 | comments => 'Physical Defense', | ||
| 133 | }, | ||
| 134 | mdef => { | ||
| 135 | data_type => 'numeric', | ||
| 136 | is_nullable => 0, | ||
| 137 | size => [12,4], | ||
| 138 | comments => 'Magical Defense', | ||
| 139 | }, | ||
| 140 | pacc => { | ||
| 141 | data_type => 'numeric', | ||
| 142 | is_nullable => 0, | ||
| 143 | size => [12,4], | ||
| 144 | comments => 'Physical Accuracy', | ||
| 145 | }, | ||
| 146 | macc => { | ||
| 147 | data_type => 'numeric', | ||
| 148 | is_nullable => 0, | ||
| 149 | size => [12,4], | ||
| 150 | comments => 'Magical Accuracy', | ||
| 151 | }, | ||
| 152 | pevd => { | ||
| 153 | data_type => 'numeric', | ||
| 154 | is_nullable => 0, | ||
| 155 | size => [12,4], | ||
| 156 | comments => 'Physical Evade', | ||
| 157 | }, | ||
| 158 | mevd => { | ||
| 159 | data_type => 'numeric', | ||
| 160 | is_nullable => 0, | ||
| 161 | size => [12,4], | ||
| 162 | comments => 'Magical Evade', | ||
| 163 | }, | ||
| 164 | ); | ||
| 165 | |||
| 166 | 3 | __PACKAGE__->utf8_columns(qw/secondary support reaction display_name/); | |
| 167 | 3 | __PACKAGE__->set_primary_key('id_combatant'); | |
| 168 | 3 | __PACKAGE__->add_unique_constraint([qw(fkey_character)]); | |
| 169 | |||
| 170 | 3 | __PACKAGE__->belongs_to(character => 'Games::Framework::RCP::Database::Result::Character', 'fkey_character'); | |
| 171 | |||
| 172 | 3 | __PACKAGE__->belongs_to(class => 'Games::Framework::RCP::Database::Result::Class', 'fkey_class'); | |
| 173 | |||
| 174 | 3 | __PACKAGE__->belongs_to(class => 'Games::Framework::RCP::Database::Result::Class', 'starting_job'); | |
| 175 | |||
| 176 | 3 | __PACKAGE__->has_many(combatant_inventories => 'Games::Framework::RCP::Database::Result::CombatantInventory', 'fkey_combatant'); | |
| 177 | 3 | __PACKAGE__->many_to_many(items => 'combatant_inventories', 'combatants'); | |
| 178 | |||
| 179 | 3 | __PACKAGE__->has_many(combatants => 'Games::Framework::RCP::Database::Result::CombatantCurrency', 'fkey_combatant'); | |
| 180 | 3 | __PACKAGE__->many_to_many(currency => 'combatants', 'currency'); | |
| 181 | |||
| 182 | 3 | __PACKAGE__->has_many(combatant_equip_histories => 'Games::Framework::RCP::Database::Result::CombatantEquipHistory', 'fkey_combatant'); | |
| 183 | 3 | __PACKAGE__->many_to_many(equip_histories => 'combatant_equip_histories', 'items'); | |
| 184 | |||
| 185 | 2 | ▶ | sub sqlt_deploy_hook { |
|
Subroutine
sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod
documented
| |||
| 186 | 2 | my ($self, $sqlt_table) = @_; | |
| 187 | |||
| 188 | 2 | $sqlt_table->options({ENGINE => 'InnoDB'}); | |
| 189 | 2 | $sqlt_table->options({CHARSET => 'UTF8'}); | |
| 190 | 2 | $sqlt_table->comments('The list of everyone that is fighting currently.'); | |
| 191 | } | ||
| 192 | |||
| 193 | 3 | 1; | |
| 194 | |||
| 195 | 3 | 1; | |
| 196 | |||
| 197 | __END__ | ||