mkproj_lib/
phk.rs

1#[allow(unused_variables)]
2pub mod phaktionz {
3    //! Phaktionz CLI is goaled to bring information on Phaktionz directly to your system
4
5    pub fn update() {
6        //! Updates Phaktionz CLI
7        //!
8        //! The Update functions essentially just cargo installs Phaktionz
9        //!
10        //! ```rust
11        //! let update = std::process::Command::new("cargo")
12        //!     .arg("install")
13        //!     .arg("phaktionz")
14        //!     .spawn();
15        //! ```
16        let update = std::process::Command::new("cargo")
17            .arg("install")
18            .arg("phaktionz")
19            .spawn();
20    }
21    pub fn fetch(sub_cmd: String, format: String) {
22        //! Fetches different aspects in HTML, EPUB or PDF
23        let _url: String = format!(
24            "https://github.com/MKProj/Phaktionz/raw/main/DOCS/{}.{}",
25            sub_cmd, format
26        );
27        let _wget = std::process::Command::new("wget")
28            .arg(&_url)
29            .spawn()
30            .expect("failed to execute process");
31    }
32    pub mod rules {
33        //! The Rules Module is based on describing various aspects of the game
34        /// This is used to describe the types of Cards (Summons, Invocations)
35        /// ```
36        /// pub struct Card{
37        ///     pub name: String, // This gives the type of Card it is ex. Striker
38        ///     pub description: String // This gives a description of what type does
39        /// }
40        /// ```
41        pub struct Card {
42            pub name: String,
43            pub description: String,
44        }
45
46        /// This is used to describe the types in Summons and Invocations  
47        /// - Summon Types:
48        ///     - Striker
49        ///     - Tech  
50        /// - Invocation Types:
51        ///     - Regular
52        ///     - Counter
53        ///     - Weapon
54        ///     - Realm  
55        ///
56        /// If a new card type would be made, then a change could look like this:  
57        ///
58        /// Before
59        /// `pub fn types(summmons: [Card; 2], invocations: [Card; 4])`  
60        ///
61        /// After (example new summon type)
62        /// `pub fn types(summmons: [Card; 3], invocations: [Card; 4])`
63        pub fn types(summmons: [Card; 2], invocations: [Card; 4]) {
64            println!("Summmons: ");
65            // This will cycle through all the struct Card fields
66            for i in 0..summmons.len() {
67                println!("\t{}: {}", summmons[i].name, summmons[i].description);
68            }
69            println!("Invocations");
70            for i in 0..invocations.len() {
71                println!("\t{}: {}", invocations[i].name, invocations[i].description);
72            }
73        }
74        ///This is used to describe the game mechanics of Phaktionz
75        /// ```rust
76        ///     pub fn game() {
77        ///         let mech: [String; 5] = [ // This is used to store all the game mech information
78        ///         String::from("• When a Summon battles it becomes disabled (turned sideways)"),
79        ///         String::from("• To place a Tier 2 or higher summon, you must demote Tiers total to the Summon’s Tier.\n\t– For example, a Tier 2 may be placed by demoting a Tier 2 or 2 Tier 1s."),
80        ///         String::from("• At the start of the game, after the turn order is chosen, both players may mulligan any cards in their hand once."),
81        ///         String::from("• If a card’s ability were to break one of these rules, the card’s ability takes precedence."),
82        ///         String::from( "• When battling, a Player takes DMG equal to the difference between the Summons.\n\t– If a Summon that battles has less DMG than the opposing, no DMG is dealt.\n\t– If a Summon that battles has more DMG than the opposing, the Opponent takes the difference, and the Summon is demoted, except if it’s Tier 3+.")
83        ///     ];
84        ///         for i in 0..mech.len() {
85        ///             println!("\t{}", mech[i]);
86        ///         }
87        /// }
88        /// ```
89        pub fn game() {
90            let mech: [String; 5] = [
91            String::from("• When a Summon battles it becomes disabled (turned sideways)"),
92            String::from("• To place a Tier 2 or higher summon, you must demote Tiers total to the Summon’s Tier.\n\t– For example, a Tier 2 may be placed by demoting a Tier 2 or 2 Tier 1s."),
93            String::from("• At the start of the game, after the turn order is chosen, both players may mulligan any cards in their hand once."),
94            String::from("• If a card’s ability were to break one of these rules, the card’s ability takes precedence."),
95            String::from( "• When battling, a Player takes DMG equal to the difference between the Summons.\n\t– If a Summon that battles has less DMG than the opposing, no DMG is dealt.\n\t– If a Summon that battles has more DMG than the opposing, the Opponent takes the difference, and the Summon is demoted, except if it’s Tier 3+.")
96        ];
97            for i in 0..mech.len() {
98                println!("\t{}", mech[i]);
99            }
100        }
101        /// This describes the various terms in Phaktionz
102        ///```rust
103        ///pub fn terms() {
104        ///let keywords:[String; 11] = [ //Contains all keywords which is iterated through
105        ///    String::from("Summons: Units that battle in the battlefield"),
106        ///    String::from("Invocations: Sorcery that may be cast to gain benefit"),
107        ///    String::from("Abled: The position in which a unit may battle"),
108        ///    String::from("Disabled: The position in which a unit is unable to battle (This is done with your Summon being sideways)"),
109        ///    String::from("Demote: To have a summon leave the battlefield"),
110        ///    String::from("Exile: To remove from play a summon"),
111        ///    String::from("Tiers: Represents the rank of a summon, Tier 1 being the lowest and 3 the highest"),
112        ///    String::from("DMG: The amount of cards a summon can deal an opponent to lose"),
113        ///    String::from("Fizzle: To stop an opponent's play"),
114        ///    String::from("L/x: Limit x per turn"),
115        ///    String::from("Lx: Limit x per match")
116        ///];
117        ///     for i in 0..keywords.len() {
118        ///         println!("\t{}", keywords[i]);
119        ///     }  
120        ///}
121        ///
122        /// ```
123        pub fn terms() {
124            let keywords:[String; 11] = [
125            String::from("Summons: Units that battle in the battlefield"),
126            String::from("Invocations: Sorcery that may be cast to gain benefit"),
127            String::from("Abled: The position in which a unit may battle"),
128            String::from("Disabled: The position in which a unit is unable to battle (This is done with your Summon being sideways)"),
129            String::from("Demote: To have a summon leave the battlefield"),
130            String::from("Exile: To remove from play a summon"),
131            String::from("Tiers: Represents the rank of a summon, Tier 1 being the lowest and 3 the highest"),
132            String::from("DMG: The amount of cards a summon can deal an opponent to lose"),
133            String::from("Fizzle: To stop an opponent's play"),
134            String::from("L/x: Limit x per turn"),
135            String::from("Lx: Limit x per match")
136        ];
137            for i in 0..keywords.len() {
138                println!("\t{}", keywords[i]);
139            }
140        }
141        /// This describe the Creation Pile
142        /// ```rust
143        ///pub fn c_pile() {
144        ///   let cp:[String; 4] = [
145        ///    String::from("• A CP Card may be added to your hand if it satisfies the Card’s Create condition."),
146        ///    String::from("• Limit: 10 (In Format V1 & V2)"),
147        ///    String::from("• Abilities that include ’CP’ refer to Creation Pile"),
148        ///    String::from("• CP Cards are identified with CP in the top left along where Tier or Invocation type is located.")
149        ///];
150        ///     for i in 0..cp.len() {
151        ///         println!("\t{}", cp[i]);
152        ///     }
153        ///}
154        /// ```
155        pub fn c_pile() {
156            let cp:[String; 4] = [
157            String::from("• A CP Card may be added to your hand if it satisfies the Card’s Create condition."),
158            String::from("• Limit: 10 (In Format V1 & V2)"),
159            String::from("• Abilities that include ’CP’ refer to Creation Pile"),
160            String::from("• CP Cards are identified with CP in the top left along where Tier or Invocation type is located.")
161        ];
162            for i in 0..cp.len() {
163                println!("\t{}", cp[i]);
164            }
165        }
166        /// This describes the Promote Mechanic
167        pub fn promote() {
168            let pr = String::from(
169                "
170    Promote brings forth two new Tiers, 0 and 4. A Tier 0/4 Summon has a limit of 1.\n
171        Tier 0:\n
172            \tTier 0’s are Summons that are placed and have a realm invocation ability,\n
173            \tas well as having these attributes:\n
174            \t• Tier : 0\n
175            \t• DMG: 0\n
176            \t• Type: T/S\n
177            \t• Promote: Yes\n
178            \t• All Tier 0’s may not be battled, and treated as a Realm Invocation\n
179        Promote: \n
180        \tTo Promote a Tier 0, is to flip it to it’s other side where it resides\n
181        \tas Tier 4, and is placed at the Tier 3 location. To Promote, the player must\n
182        \tsatisfy a Promote condition that is described on the Card. If you control a\n
183        \tSummons on the Battlefield and choose to Promote, the Summons will be demoted.\n
184        Tier 4:\n
185        \tTier 4’s are usually a win condition card and are built to not stay on the\n
186        \tfield for long. While you control a Tier 4 you cannot have any other Summons\n
187        \ton the Battlefield. As well as that, they have the following attributes:\n
188            \t• Tier: 4\n
189            \t• DMG: 7/8\n
190            \t• Type: T/S\n
191            \t• All Tier 4’s cannot be demoted in Battle nor be demoted by any Abilities\n
192            \t• At the end of each End Phase the player takes Damage equal to it’s DMG\n
193                \t\t– Refusal to pay will result in it being exiled.
194        ",
195            );
196            println!("{}", pr);
197        }
198        ///This is used to list all the rule commands (all available functions)
199        pub fn list() {
200            let opt: [String; 6] = [
201                String::from("types"),
202                String::from("game-mech"),
203                String::from("terms"),
204                String::from("c-pile"),
205                String::from("promote"),
206                String::from("all"),
207            ];
208            let desc: [String; 6] = [
209                String::from("Lists out all Summon/Invocation Types"),
210                String::from("Lists out all the Game Mechanics"),
211                String::from("Lists out all the key terms"),
212                String::from("Describes what Creation Pile is"),
213                String::from("Describes what Promote is"),
214                String::from("Does all commands above"),
215            ];
216            println!("Available Options for Rules: ");
217            for i in 0..opt.len() {
218                println!("\t{}: {}", opt[i], desc[i]);
219            }
220        }
221        /// This is used to process all the rule commands
222        pub fn rules(option: String, summmons: [Card; 2], invocations: [Card; 4]) {
223            let opt: [String; 7] = [
224                String::from("types"),
225                String::from("game-mech"),
226                String::from("terms"),
227                String::from("c-pile"),
228                String::from("promote"),
229                String::from("all"),
230                String::from("list"),
231            ];
232
233            if option == opt[0] {
234                types(summmons, invocations);
235            } else if option == opt[1] {
236                game();
237            } else if option == opt[2] {
238                terms();
239            } else if option == opt[3] {
240                c_pile();
241            } else if option == opt[4] {
242                promote();
243            } else if option == opt[5] {
244                types(summmons, invocations);
245                println!("\n");
246                game();
247                println!("\n");
248                terms();
249                println!("\n");
250                c_pile();
251            } else if option == opt[6] {
252                list();
253            }
254        }
255    }
256
257    /*pub mod story {
258        //! This is used to describe the various episode concepts
259        /// To give info on how to access each episode concept
260        /// ```rust
261        ///pub struct Episode {
262        ///     pub name: String,
263        ///     pub season: i32,
264        ///     pub episode: i32,
265        ///     pub url: String,
266        ///  }
267        /// ```
268        pub struct Episode {
269            pub name: String,
270            pub season: i32,
271            pub episode: i32,
272            pub url: String,
273        }
274        /// This is used to access the pdf files in a temporary access way
275        ///
276        /// You will need the url that is provided by the Episode struct, and pdf application that is
277        /// required by the story subcommand.
278        ///
279        /// ```rust
280        /// pub fn read(url: String, pdf_application: String) {
281        ///     let read = std::process::Command::new(pdf_application).arg(url).output();
282        ///     // This issues a command line command to use the pdf application and load the pdf with url
283        /// }
284        /// ```
285        pub fn read(url: String, pdf_application: String) {
286            let read = std::process::Command::new(pdf_application)
287                .arg(url)
288                .output();
289        }
290    }*/
291
292    pub mod book {
293        //! This is used to initialize and serve the phaktionz markdown book
294        pub fn init() {
295            let gitclone = std::process::Command::new("git")
296                .arg("clone")
297                .arg("https://github.com/MKProj/Phaktionz-Book.git")
298                .spawn();
299        }
300        pub fn serve() {
301            println!("Make sure you have first ran phaktionz init!");
302            let serve = std::process::Command::new("mdbook")
303                .arg("serve")
304                .arg("Phaktionz-Book")
305                .spawn();
306        }
307    }
308
309    pub mod info {
310        //! This is used to give information about the Factions Categories
311        pub struct Category {
312            pub name: String,
313            pub desc: String,
314        }
315
316        pub fn Info(name: String, cat: Vec<Category>) {
317            let mut i = 0;
318            while i < cat.len() {
319                if name == cat[i].name {
320                    println!("{}", cat[i].desc);
321                } else if name == "list" {
322                    println!("\t*{}", cat[i].name);
323                }
324                i += 1;
325            }
326        }
327    }
328
329    pub mod profiles {
330        //! This is used to make the character profiles
331        pub fn prof(option: String, characters: Vec<Profile>) {
332            for i in 0..characters.len() {
333                if option == characters[i].fname {
334                    println!(
335                        "Name: {} {}\nAge: {}\nHeight: {}\nFaction: {}\nDecks: {}\nDescription: \n{}\n",
336                        characters[i].fname,
337                        characters[i].lname,
338                        characters[i].age,
339                        characters[i].height,
340                        characters[i].factions,
341                        characters[i].decks,
342                        characters[i].description
343                    );
344                } else if option == "list" {
345                    println!("\t*{}", characters[i].fname);
346                }
347            }
348        }
349        pub struct Profile {
350            pub fname: String,
351            pub lname: String,
352            pub age: i64,
353            pub height: String,
354            pub factions: String,
355            pub decks: String,
356            pub description: String,
357        }
358    }
359}