tama 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e9bd53bcec2e1dd606743c1df20a664dd223398
4
- data.tar.gz: 1075e2a0f0567d12c32fca1175a5cbd00395a763
3
+ metadata.gz: 14d40ac9dfd74bacac7aec1893fc2b5cdf83e82b
4
+ data.tar.gz: 25f1f77457f1b40fe8389ce231f1febf3e1224f7
5
5
  SHA512:
6
- metadata.gz: bbc158c9a05120371b2bbb74eb5f7394426ee2b3b793195d4b37c5f766f88b9f9a30c24c706e1650f78efbbfb529cf1dff136b1f7e1db082f07e689f05f24cec
7
- data.tar.gz: 590cc2eb6e1e6da2bff32f493d38120e530fc263f319fcbba57cbd67f1ceed163f2504119657aad34c4602ad9b5a0201387b2d7b2523e2b5fec2333e6b5cd468
6
+ metadata.gz: 7cdb90e998e6effd666e3bacf374956850bb8da9f152232a1cd5745320e49533ff5118de81310ae0190f989f7d4381b01a746b013da9e50c7c3597717b7c0dea
7
+ data.tar.gz: 4be9e716da03f3b180b14dccfe14ef532953c169560c088f5bdf9bc6b5adb0602eaf9d049e031e97807f009d26b1aa88ebc7eed18712066b3d6eb5a418283a81
@@ -1,44 +1,79 @@
1
1
  # encoding: utf-8
2
2
  module Tama
3
+ require 'chronic'
4
+ require_relative 'constant'
5
+
3
6
  #Classe animal dont herite Virtualanimal.
4
7
  #Elle contient toutes la base du tamagotchi
5
8
  class Animal
6
9
  @@nbreAnimal=0 #Un player ne devra pas avoir plus d'un tama
7
- @health=0
8
- @mental=0
10
+ attr_reader :health
11
+ attr_reader :mental
12
+ attr_reader :DateBirth
13
+ attr_reader :Date_of_death
9
14
 
10
15
  #Construteur principal
11
16
  def initialize
12
- @health=100
13
- @mental=100
17
+ @health=$TAMA_HEALTH
18
+ @mental=$TAMA_MENTAL
14
19
  @@nbreAnimal+=1
15
20
  puts "Creation de l'animal \n"
21
+ @DateBirth=Chronic.parse("now")
22
+ @Date_of_death=Chronic.parse("#{$TIME_OF_LIFE} minutes from now")
16
23
  end
17
24
 
18
25
  #Fonction manger du tama
19
- def feed(health, mental)
26
+ def feed
20
27
  puts"Votre animal se nourrit \n"
28
+ @health += 30
21
29
  return 1
22
30
  end
23
31
 
24
32
  #Fonction enseigner du tama
25
- def teach(health, mental)
33
+ def teach
26
34
  puts"Votre animal apprend quelque chose \n"
35
+ @mental += 10
27
36
  return 2
28
37
  end
29
38
 
30
39
  #Fonction soigner du tama
31
- def cure(health, mental)
40
+ def cure
32
41
  puts"Vous soignez votre animal \n"
42
+ @mental +=30
43
+ @health +=60
33
44
  return 3
34
45
  end
35
46
 
36
47
  #Fonction nettoyer le tama - le faire prendre
37
48
  #un bain
38
- def clean(health, mental)
49
+ def clean
39
50
  puts"Vous nettoyez votre animal \n"
51
+ @mental +=10
52
+ @health +=30
40
53
  return 4
41
54
  end
55
+
56
+ #Fonction qui permet de savoir
57
+ #si le tama est vivant ou mort
58
+
59
+ def isAlive?
60
+ time_to_die=@Date_of_death
61
+ actual_time=Chronic.parse("now")
62
+ if actual_time > time_to_die
63
+ puts "Votre tama est mort"
64
+ return false
65
+ else
66
+ puts "Votre tama est vivant"
67
+ return true
68
+ end
69
+ end
70
+
71
+
72
+
73
+ def DieOfTama
74
+ ObjectSpace.garbage_collect
75
+ end
76
+
42
77
 
43
78
  end
44
79
  end
data/lib/tama/constant.rb CHANGED
@@ -4,4 +4,28 @@ module Tama
4
4
  #qui comprendront tout ce que devra etre
5
5
  #statique sur le tama
6
6
 
7
+
8
+ #Constante globale qui determine le temps de vie de tout tamagotchi
9
+
10
+ $TIME_OF_LIFE=3600
11
+
12
+ #Constante par défaut de la vie du tama sante et mental
13
+
14
+ $TAMA_HEALTH=100
15
+ $TAMA_MENTAL=100
16
+
17
+ # Tableau qui determine les etats de vie du tamagotchi
18
+
19
+ $STATE_OF_LIFE=["Oeuf","bebe","enfant","adulte","age","mort"]
20
+
21
+ #Humeur du tama
22
+
23
+ $MOOD=["heureux","neutre","melancolique","depressif","triste"]
24
+
25
+ # Un tama ne peut pas etre immortel => cette constante assure ce probleme
26
+ # A reflechir dessus
27
+
28
+ $TAMA_MAX_LIFE=9600
29
+
30
+
7
31
  end
@@ -6,7 +6,13 @@ module Tama
6
6
  @name=""
7
7
  @time_playing=0
8
8
 
9
- def initialize
9
+ def initialize(name)
10
+ @name= name
11
+
12
+ #Offrir des possibilites
13
+ #au joueur a creuser
14
+ #Actions qu'il effectue
15
+ #sur le tama a faire
10
16
  end
11
17
  end
12
18
  end
data/lib/tama/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tama
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,8 @@
1
+ require 'bacon'
2
+ require '/home/simplon/Desktop/TamaApp/tamaGem/tama/lib/tama/animal_class.rb'
3
+
4
+ describe Animal do
5
+
6
+ end
7
+
8
+
data/test/tama_test.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'test/unit'
2
+ require '/home/simplon/Desktop/TamaApp/tamaGem/tama/lib/tama.rb'
3
+
4
+ class VirtualAnimal < Test::Unit::TestCase
5
+ def test_initialize
6
+
7
+ end
8
+
9
+ def test_main
10
+
11
+ end
12
+
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tama
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mori
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,6 +100,8 @@ files:
100
100
  - lib/tama/player_class.rb
101
101
  - lib/tama/version.rb
102
102
  - tama.gemspec
103
+ - test/tama/animal_class_test.rb
104
+ - test/tama_test.rb
103
105
  homepage: http://github.com/mosleymos/tama.com
104
106
  licenses:
105
107
  - MIT
@@ -124,4 +126,6 @@ rubygems_version: 2.2.1
124
126
  signing_key:
125
127
  specification_version: 4
126
128
  summary: Tama est un projet de tamagotchi en version informatique.
127
- test_files: []
129
+ test_files:
130
+ - test/tama/animal_class_test.rb
131
+ - test/tama_test.rb